Forum Discussion
JPrince_22
6 years agoHelper I
Cumulative sum using filtered dates
Hi all i have a series of Graphs in Power BI which reference two different amount fields, and two date fields. There is an active relationship on one and the measure works fine, however when tryi...
- 6 years ago
Try one of the two.
Deposits Received = var MaxAcc = MAXX('Servicing Accounts',[account_funded_date]) Return calculate(sum([ledger_balance]),('Servicing accounts'),'Servicing accounts'[account_funded_date] <=MaxAcc, userelationship('Servicing accounts'[account_funded_date],DateTable[Date])) Deposits Received = calculate(sum([ledger_balance]), userelationship('Servicing accounts'[account_funded_date],DateTable[Date]))Can you share sample data and sample output.
Anonymous
6 years agoNot applicable
The table is a cartesian join of the calendar to itself, then you cleanup the records where the calendar dates are greater than the As-Of dates. You end up with a table of As-Of dates with a record for every calendar_day that is equal to or prior to the As-Of date.
So Sum({<End=P(calendar_day)>} Value)
- JPrince_226 years agoHelper I
Sorry I don't follow, how to I need to edit the measure to solve this?
- amitchandak6 years agoSuper User
JPrince_22 , can mark the user @ for whom this question is. In case you are looking at what I posted you have to Change Max to MAXX in var in the formula
- JPrince_226 years agoHelper I
Hi amitchandak
I have edited this as suggested, but still not working. It now reads:
Deposits Received = var MaxAcc = MAXX('Servicing Accounts',[account_funded_date]) Return calculate(sum([ledger_balance]),allselected('Servicing accounts'),'Servicing accounts'[account_funded_date] <=MaxAcc, userelationship('Servicing accounts'[account_funded_date],DateTable[Date]))