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
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
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.

Top Solution Authors