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
Marcin
Helper V
Helper V

Cumulative total by selected time range

Hi,

 

I would like to create 12 months cumulative total and present it on chart. 

 

Capture.PNG

The case is that when I use both Year and Month filters I would like the Cumulative Sales to be calculated as last 12 months before selected month , now I have only one month presented :

Capture2.PNG

 

The definition of my cumulative measure : 

 

Cumulative Quantity =
IF (
MIN ( 'Date'[DateKey] )
<= CALCULATE ( MAX ( Sales[OrderDateKey] ), ALL ( Sales ) ),
CALCULATE (
[Distinct Sales],
FILTER (
ALL ( 'Date'[Date] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
)
)
)
3 REPLIES 3
Geradav
Responsive Resident
Responsive Resident

Hi @Marcin 

 

Check out this video https://youtu.be/duMSovyosXE

That will give you exactly what you are looking for.

 

Does that work for you?

Hi @Geradav ,

 

I saw this video before and it's presenting absolut values not cumulative so it;s not what I am looking for. 

Geradav
Responsive Resident
Responsive Resident

Hi @Marcin 

I actually followed the instruction in the video and adapted it to calculate a cumulative instead of absolute results and came up with the following

Untitled Project.gif

 

I created an independent calendar from which I created the slicers and retrieved the first date of the desired period. I did it over 3 months because my model is not big enough to go back 12 but here is the DAX statement for 12 months

Cumul =
VAR MinDate =
    EOMONTH ( MAX ( IndependentCalendar[Date] ), -12 ) + 1
RETURN
    CALCULATE (
        [Current Profit],
        DATESBETWEEN ( 'Sample Data'[Date], MinDate, MAX ( 'Sample Data'[Date] ) )
    )

Does that correspond to what you were looking for?

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.