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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ouafaa
Helper II
Helper II

Ho to calculate the cumulative of a mesure, month by month

hello,

I have a measure that calculates a sum of a column of the sales history table according to the month and the year chosen on two slicers month and year (doing conditions based on choosen month and year in a slicer) I want to make another mesure which makes me the accumulation of the first mesure when I choose several months knowing that the sum must be = the sum of the first measure month by month between a minimum month chosen and a maximum month chosen since on the month filter I have the possibility of choosing several months how can i do that?
it's as if I have to make a sum on the result of a function with entry of each function one month among the months chosen on the slicer total = function(minchosenmonth,chosenyear)+function(month2,chosenyear) ... function(maxchosenmonth,chosenyear

simple sum gives me wrong value

Thank you for any help

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

If the slicer is choosing a range of dates from your Date table then you could do

Total =
var summaryTable = ADDCOLUMNS( VALUES('Date'[Year month]), "@val", [Existing measure])
return SUMX( summaryTable, [@val])

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

If the slicer is choosing a range of dates from your Date table then you could do

Total =
var summaryTable = ADDCOLUMNS( VALUES('Date'[Year month]), "@val", [Existing measure])
return SUMX( summaryTable, [@val])

Hello,

 

It works! thank you very much !

amitchandak
Super User
Super User

@ouafaa ,  Not very clear

 

You can try a measure like

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hello,

 

Thank you for your help but it does not work.

My PBIX is too large and contains sensitive data, I will create a sample one juste like an exemple or juste copy some excpected results and will share it so you can see what i'm trying to do

Thank you again

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.