on 03-13-2019 3:29 PM
Query 1 gives start and end date parameters and an initial value
Query 2 holds transaction data by date (date and amount).
Desired end result is a data table beginning with start date in Query 1 and initial value in Query 1. I need a line for each entry in Query 2 though the end date in Query 1.
For example, Query 1 is 3rd quarter 2018 (10/1/2018 through 12/31/2018). Initial value is 100,000
Query 2 has the following
10/15/2018 50,000
11/7/2018 -10,000
12/6/2018 5,000
Required End Result Table
10 /1/2018 - 10/15/2018 100,000
10/15/2018 - 11/7/2018 150,000
11/7/2018 - 12/6/2018 140,000
12/6/2018 - 12/31/2018 145,000
Any assistance would be greatly appreciated. Thank you.
Hi Veronica,
Further to your comment dated Apr 23 at 09:30 PM and my response dated Apr 25 I am not quite sure I understand the limitation correctly. If you look at the sample data set in the explanation/description I provided on Mar 26 you will notice that Account Number 22222-2 has got two transactions before the Start Date with - in my view - no additional line. Maybe you can provide a screenshot to highlight the issue?
Kind regards,
Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Veronica,
Apologies for the radio silence on this.
You may have found a solution yourself but in case you didn’t here is how you can get to your desired result.
We need to run three queries instead of just the two as otherwise we have difficulties in synchronising the data correctly:
Query 1 (Acct Start): [Account Number], [Start Date], [Initial Amount]
Query 2 (Acct End): [Account Number], [End Date]
Query 3 (Acct Payment): [Account Number], [Date], [Amount]
Once you have run the three queries, merge the Account Numbers and Dates as follows:
1. Merge all [Account Number] dimensions into one [Account Number] merged dimension, making [Account Number (Acct Start)] the source dimension
2. Merge [Date], [End Date] and [Start Date] into one [Date] merged dimension, making [Date (Acct Payment)] the source dimension
In the next steps, create four measure variables:
1. [Full Amount] =[Amount]+[Initial Amount]
This simply merges the two measures from our queries 1 and 3 into one measure so we can use RunningSum() on just one measure variable.
2. [Running Sum] =NoFilter(Previous(RunningSum([Full Amount];([Account Number]));([Account Number]);1))
We are working with the Previous() function to ensure we allocate the correct values in each row according to their begin and end dates (see next variable). The NoFilter() function is important as you will need to apply a table filter later on.
3. [Date From] =NoFilter(If(IsNull(Previous([Amount];([Account Number]);1)) And IsNull(Previous([Initial Amount];([Account Number]);1))) Then ([Start Date]) Else Previous([Date];([Account Number]);1))
We need to be a little inventive to pair the correct begin dates (Date From) with the relevant end dates (Date To, i.e. Date). In order to achieve this, we do a row-by-row validation against amount and initial amount and allocate the start date from Query 1 where there are no values for both of them, or the Previous([Date]) value where there are values for either Amount or Initial Amount. Again, we need the NoFilter() function as a wrapper.
4. [Hide Me Filter] =[Date] > Max([Start Date]) In([Account Number])
This variable acts as a helper variable to dispose of those rows which contain transaction dates smaller than the start date in each account number.
Now that you have created the four variables you can move on to create your report:
1. Open a new report tab and pull the following objects onto the report canvas:
[Acct Start].[Account Number], [Date From], [Date], and [Running Sum]
As you can see from the screenshot above, we have begin and end dates as we want them. But we still need to dispose of the lines framed in red:
To do this, you now apply a filter to your table block: [Hide Me Filter] Equal To 1
Finally, insert a section, using the [Account Number] merged object and adjust the section and/or table layout to your needs.
If you are retrieving hundreds of account numbers I would also consider creating an Input Control on [Account Number] for quicker navigation in preference to the report tab. In my opinion, using both Input Control and Report Map in combination works best.
Let me know how you got on.
Kind regards,
Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tom - apologies for the delayed response. This works with some limitations. When my Account Payment file has a two transactions before the Start Date in the Acct Start file, I get an unwanted first line of line, as I now have a full line of data (Start and End). Any suggestions other than removing the transactions in the Account Payment file (which is possible, but not preferable, as this is a process I hope to perform on a scheduled, on-going basis).
Tom,
If there are no transactions between the start date, I need one line in my table with the start date and end date. So for 11111-1 I would need a line with 10/1/2018 - 1/1/2019.
For 22222-2, I would want the first line to start with the date from Q1 (the account). I do not want or need to see any transactions before that date, but I also do not want to have to limit my data coming in from Q2.
22222-2 desired end result in example would be
12/1/2018 - 12/22/2018
12/22/2018 - 1/1/2019
I need to be able to perform calculations on the each line, using DaysBetween the two dates (multiplying the running sum times rate times the number of days divided by a basis code -- an interest calculation).
Data source is a vendor who houses our data. The payment information is first run as a separate summed up to a date level and then brought back in as a Hold File.
My end report is a .pdf that is sectioned by account number.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My end date should always the prior business date, as that is the date the statement should cut off.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Veronica,
I am still looking into this but the new account dimension does prove to be an extra challenge...
Looking at your samples, I have a few more questions:
Kind regards,
Tom
Some accounts are a 90 day date-range and some are a 30-day date range (billed on a monthly or quarterly basis). End goal is to schedule this report and drop statements when the "end date" from Q1 changes from the previous day. I really should not have transactions after my end date, but I do know because I am working with a snapshot of a prior month-end. We can assume I won't have those going forward.
My end date for a quarter (or cut-off period) could be a few days after a month end but not in the middle of the month
Some accounts will have no transactions between the start and end date. Some accounts will have many transactions.
Created a sample file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much. I have not been clear enough in my example.
Q1 is not traditional quarters. It does have a start date and end date, but these vary from account to account.
Q2 has data with dates before and after the "Start" and "End" dates.
I am getting a #COMPUTATION error and I am getting lines outside of my date range.
Also, I do not need to have the "From Date" and "To Date" in one field. It is OK if I do that but not necessary. I will need to perform calculations using "Days Between" those two fields.
Again, thank you for any tips. I really appreciate it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Veronica,
Do your account specific quarters at least start and end within the traditional quarter definition, e.g. 01/04/2019 - 03/23/2019, or could they start/begin outside the normal ranges?
Could you possibly upload/attach a larger sample (csv or txt would be fine) that includes all possibilities you have?
Thanks,
Tom
Hi Veronica,
You can achieve this by following these steps:
The [End Date] variable forces the relevant quarter end date in combination with the [Date Range] variable
Please let me know whether this worked for you.
Kind regards,
Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have webi and desktop both available to use.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.