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
andy_pat
Helper I
Helper I

Cumulative Total for Custom Period

Hi Experts - I have a working cumulative total measure for a date Axis.  The total starts at a dynamic period which is determined by the date slicer.

 

See attached pbix file with sample data for reference here.

 

Goal is to have X axis display the range of slicer as integers like Day 0,1, 2 and so on from the starting date and calculate the cumulative total for that range, while ignoring the month boundary.   So if the slicer date range is April 6 to May 30, the X axis range should be from 0 to 40.

 

 

 

Total Sale = 
VAR MAXDATE = LASTDATE(Dates[Date]) 
VAR MINDATE = FIRSTDATE(Dates[Date]) 
RETURN 
 CALCULATE(
            SUM('Table'[Sale]),
            FILTER
                (
            ALLSELECTED(Dates),
            Dates[Date] <= MAXDATE 
            // && Dates[Date] >= MINDATE
                )
            )

 

 

The "Total Sale" measure should increase as the range progresses.

 

The goal is to look at a dynamic trend for total sales based on selected time period selected, so the total should start at the first selected date and continue until last slicer date

 

Any help would be appreciated. 

 

Thanks

Andy

1 ACCEPTED SOLUTION

@andy_pat , I checked it your file working correctly. You are using Day, which is across the month. Plot it on the date and check

 

or try like

Total Sale =
CALCULATE(
SUM('Table'[Sale]),
FILTER
(
ALLSELECTED(Dates),
day(Dates[Date]) <= day(max(Dates[Date]))
)
)

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@andy_pat , Try like

Total Sale =
CALCULATE(
SUM('Table'[Sale]),
FILTER
(
ALLSELECTED(Dates),
Dates[Date] <= max(Dates[Date])
)
)

Thanks!  I tried it, but it doesn't work. I get the same issue.

@andy_pat , I checked it your file working correctly. You are using Day, which is across the month. Plot it on the date and check

 

or try like

Total Sale =
CALCULATE(
SUM('Table'[Sale]),
FILTER
(
ALLSELECTED(Dates),
day(Dates[Date]) <= day(max(Dates[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.