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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bestevez
Helper I
Helper I

Dax sum cumulative by selected day for month and year

Hi,

 

I have a problem I need to solve.

 

I have the follow

 

Day1234567891011121314
Sales20304020201512131819151210

11

 

and I need to calculate the next matrix

 

Day714
Sales157255

 

Where 157  is the cumulative sales of the first seven days and 255 is the sum of the days since 1 to 14 then i will need 1 to 21

 

I need to select the days for example if i select the day 8 then 1 to 8 

 

Thanks for the help like always.

7 REPLIES 7
Anonymous
Not applicable

Below Measure can be used - 

 

Cumulative_Sum = CALCULATE(SUM(TableName[Sales]),FILTER(ALL(TableName),TableName[DateCol] <= MAX(TableName[DateCol])))

Hi,

 

The problem is that I can't select the day and accumulate it. What makes me that measure is to give me the cumulative maximum of the month, but, if I select a day gives me the value of that day selected.

 

Thanks

Anonymous
Not applicable

With the measure, it will show the cumulative sum upto the date selected.

Sorry I dont understand clearly what you are trying achieve. Can you provide an example.

HI,

 

for example i want to select a day 7, 14, 21 and 30 or 31 and see a cumulative sales of a month. 

 

 

Sin título.png

I got it with this measure CALCULATE( SUM( sales ); DATESMTD( date[date] ) )

Anonymous
Not applicable

The measure you are using will work only for a month if you have dates for more than a month. The cumulative sum will start afresh as you are using MTD. 

Try using the measure I gave, it should work for you.

 

Sin título.png

Your measure adds a cumulative from the beginning of the data and not from what was selected.

bestevez
Helper I
Helper I

Hi,

 

i try this CALCULATE( SUM(sales); DATEMTD(dim_date[Fecha]) )

 

Thanks for all

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.