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
Anonymous
Not applicable

Slicer not acting as expected with cumulative totals

Hi,
I have a dataset that looks like this:


Worklogs

SpentDateDataEntryDateSecondsSpent
26/07/202326/07/202327000
27/07/202330/07/202313500
27/07/202330/07/202313500

 

RequiredTime

RequiredDateRequiredSeconds
26/07/202327000
27/07/202327000

 

Calendar (created using DAX)

DateYearQtrQtrNumMonthMonthNumMonthYearNumMonthYearDayDayName
          

Here's the DAX I used:

 

Calendar = 
VAR _calendar = CALENDARAUTO()
RETURN
    ADDCOLUMNS(
        _calendar,
        "Year", YEAR([Date]),
        "Qtr", "Q"& FORMAT([Date],"Q"),
        "QtrYear", "Q"& FORMAT([Date],"Q yyyy"),
        "QtrNum", FORMAT([Date],"Q"),
        "Month", FORMAT([Date],"mmmm"),
        "MonthNum", MONTH([Date]),
        "MonthYearNumber",FORMAT([Date],"yymm"),
        "MonthYear",FORMAT([Date],"mmm yyyy"),
        "Day",Format([Date],"dd"),
        "DayName",Format([Date],"dddd"
    ))

 

I have created a date hierarchy from this table that is like this:

  • Dates
    • Year
    • QtrYear
    • MonthYear
    • Day

 

I have the following measures:

 

Spent (d) = 
DIVIDE(SUM('Worklogs'[SecondsSpent]),27000)

 

 

 

Cumulative Days Spent (SpentDate)  =
CALCULATE(
    [Spent (d)],
    USERELATIONSHIP(Worklogs[SpentDate],'Calendar'[Date]),
    FILTER(ALL('Calendar'[Date]),'Calendar'[Date] <= MAX('Calendar'[Date])))

 

 

 

Cumulative Days Spent (DataEntryDate) = 
CALCULATE(
    [Spent (d)],
    USERELATIONSHIP(Worklogs[DataEntryDate],'Calendar'[Date]),
    FILTER(ALL('Calendar'[Date]),'Calendar'[Date] <= MAX('Calendar'[Date])))

 

 

 

Expected (d) = 
DIVIDE(SUM(RequiredTime[RequiredSeconds]),27000)

 

 

 

Cumulative Expected (d) = 
CALCULATE(
    [Expected (d)],
    USERELATIONSHIP(RequiredTime[RequiredDate],'Calendar'[Date]),
    FILTER(ALL('Calendar'[Date]),'Calendar'[Date] <= MAX('Calendar'[Date])))

 

 

I want to create a line chart that plots the Date on the x-axis and all three cumulative values on the y-axis. I'd then like to use a slicer for the date so that I can see a single month in isolation.

 

The line chart seems to work OK when not using a slicer, but it shows far too much data to be valuable for my use case - the data goes back ~10 years in the Worklogs table, but only ~5 years in the RequiredTime table.

 

When I use the slicer (the date hierarchy from the calendar table), the Spent (d) and Expected (d) values are returned correctly, but the cumulative values seem to calculate by summing all values up to and including the date selected. I'd like the cumulative values to only sum values for the month selected in the slicer.

 

Thanks in advance.

Sean

0 REPLIES 0

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.