Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JPrince_22
Helper I
Helper 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 trying to use the inactive measure the sum is giving me a daily figure, rather than cumulative. 

 

The measure that is working correctly is as follows:

 

 

PledgedAcount = Calculate(
Sum('Servicing Accounts'[PledgeAmount]),
FILTER(
AllSelected('Servicing Accounts'),
'Servicing Accounts'[PledgeDate] <= MAX('Servicing Accounts'[PledgeDate])
))

 

and the measure returning a daily figure rather than a cumulative total is:

 

 

Deposits Received = Var MaxAcc = Max([Account_funded_date]) 
Return(
Caluclate(
Sum([Ledger_Balance]),
AllSelected('Servicing Accounts'),
'Servicing Accounts'[Account_Funded_date] <= MaxAcc, 
UseRelationship('Servicing Accounts'[Account_Funded_date],DateTable[Date])
)
)

 

And ideas on where i am going wrong?

 

thanks 

 

1 ACCEPTED SOLUTION

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.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

8 REPLIES 8
Anonymous
Not 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)

Sorry I don't follow, how to I need to edit the measure to solve this? 

@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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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]))

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.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

hi @amitchandak 

 

Measuer 2 did the trick, so simple afterall!!

 

thank you 

amitchandak
Super User
Super User

Try MAXX

 

Deposits Received =
Var MaxAcc = MaxX('Servicing Accounts', [Account_funded_date])
Return
Caluclate(
Sum([Ledger_Balance]),
AllSelected('Servicing Accounts'),
'Servicing Accounts'[Account_Funded_date] <= MaxAcc,
UseRelationship('Servicing Accounts'[Account_Funded_date],DateTable[Date])
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Same result unfortunately 

 

 
 
 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.