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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative sum by year not working for measure

I Read multiple posts and tried multiple variants to write this formula but it isn't working as expected.

 

jbrandao_0-1627977261900.png

 

Simply put, I want "Measure 3" to be running total of Measure Tax Due.

This is the code I'm using for Measure 3:

 

Measure 3 =
var maxdate = max(years[year])
return
calculate([Tax Due], years[year]<=maxdate, All(years))
 
--> The calculation seems to be right on the last year - all the other values seem messed up...
 
I also tried using fields formatted as date:
 
jbrandao_1-1627977463217.png

 

but got exactly the same result:

 

jbrandao_2-1627977510570.png

@Anonymous 

 

Any help would be highly appreciated!

 

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

This is supposed to be matrix, right? I'm a little confused about your data,like below:

vyalanwumsft_0-1628129641814.pngvyalanwumsft_1-1628129694815.png

If use table ,it will show right.

vyalanwumsft_2-1628129785460.png

So can you share more information about your data or share .PBIX to remove sensitive information?

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , you should prefer separate year/date table

 

Measure 3 =
calculate([Tax Due], filter(allselected(year), years[year]<=max(years[year])))

 

or

 

Measure 3 =
calculate([Tax Due], filter(allselected(year), years[Date]<=max(years[Date])))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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