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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Running sum showing all values

Hi guys,

currently I´m trying to create a line chart showing the running sum for all hours worked per month. This should look something like that:
result.PNG








I´m using following DAX to calculate the hours worked accumulated for every month:

 

Running sum hours worked =
VAR MaxDate = DATEVALUE([DatePicker]) // gets the date defined by the slicer selection
RETURN

CALCULATE([HoursWorked];FILTER(ALL(Mastercalendar);DATEVALUE(Mastercalendar[Date])<=MaxDate))

 

The [DatePicker]-Measure should work as it shows me the right selected date.

If I'm filtering the values by using the slicer, it always shows me the correct, accumulated sum for the selected month - Unfortunately just for the selected month and not for all available months until the selected date.

That's the result I'm currently receiving:
result2.PNG


Thanks for your suggestions!

7 REPLIES 7
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

For your case, you need to use a separate calendar for slicer.

and here is a same logic case for you refer to:

https://community.powerbi.com/t5/Desktop/last-5-years-and-apply-year-filter-to-other-visuals/m-p/808765#M388901

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
az38
Community Champion
Community Champion

Hi @Anonymous 

in fact you are trying to compare  DATEVALUE([DatePicker]) with DATEVALUE([DatePicker]) 🙂 of course, it gives you the only value. try

Running sum hours worked =
VAR MaxDate = DATEVALUE([DatePicker]) // gets the date defined by the slicer selection
RETURN

CALCULATE([HoursWorked];FILTER(ALL(Mastercalendar);SELECTEDVALUE(Mastercalendar[Date])<=MaxDate))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi @az38,
thanks for your quick response!
If I´m changing my formula to what you´ve mentioned, it shows me the total accumulated sum for the last available month for the filtered month.
For example: I'm selecting 2019/12/31 it shows me the accumulated total for the last available date 2020/01/23 in the month of December 2019 - so not correct.

az38
Community Champion
Community Champion

@Anonymous 

it depends on your exactly data model

im not sure your statement 

MaxDate = DATEVALUE([DatePicker])

is correct. maybe it is better to use something like 

MaxDate = CALCULATE(MIN([DatePicker]))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi @az38 ,

I tried that - then it logically shows no value.

My Mastercalendar looks like that:
Daten Masterkalender.PNG













That`s my formula for the [DatePicker]-Measure (fairly, that could probably be done much better...):

DatePicker = EOMONTH(DATE(if(ISFILTERED(Mastercalendar[Year]);SELECTEDVALUE(Mastercalendar[Year];"no filter");"no filter");if(ISFILTERED(Masterkalender[Monat_Name]);
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Januar";1;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Februar";2;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="März";3;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="April";4;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Mai";5;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Juni";6;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Juli";7;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="August";8;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="September";9;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Oktober";10;
    if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="November";11;
 if(SELECTEDVALUE(Masterkalender[Monat_Name];"no filter")="Dezember";12;"no filter")))))))))))));1);0)


Just to give you the full context, my slicers look like that:
Slicer.PNG















In my eyes it seems like the Mastercalendar isn't really giving all the dates below VAR MaxDate...

az38
Community Champion
Community Champion

@Anonymous 

and the second point: whats table do you add your initial measure [Running sum hours worked]?

let's say, you try to add it to 'Table1' try

 

Running sum hours worked = 
VAR MaxDate = DATEVALUE([DatePicker]) 
RETURN

CALCULATE([HoursWorked];FILTER(ALL('Table1');[Date]<=MaxDate))

 

because, your construction 

CALCULATE([HoursWorked];FILTER(ALL(Mastercalendar);SELECTEDVALUE(Mastercalendar[Date])<=MaxDate))

will try to caculate something somewhere in calendar table, but not in fact table

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
az38
Community Champion
Community Champion

@Anonymous 

in your statement I see two different calendar table names: Masterkalender and Mastercalendar

Is it correct?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors