Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I created a measure for a running total by month, the coding used is:
I want a running total for every month, if there is no value for that month, just carry the previous month's value forward. Would appreciate if someone can advise how to revise the DAX?
Solved! Go to Solution.
Hi,
Thank you for your feedback.
Please check the below if it suits your requirement.
-Jun value shows in the table visualization
-only upto Nov values are shown.
Cumulative =
VAR _lastdateinscheduletable =
CALCULATE ( MAX ( Schedule[Forecasted Date] ), REMOVEFILTERS () )
RETURN
CALCULATE (
SUM ( 'Schedule'[Forecast] ),
USERELATIONSHIP ( CalendarM[Date], 'Schedule'[Forecasted Date] ),
FILTER (
ALLSELECTED ( 'CalendarM' ),
CalendarM[Date] <= MAX ( CalendarM[Date] )
&& CalendarM[Year] = MAX ( CalendarM[Year] )
&& MIN ( CalendarM[Date] ) <= _lastdateinscheduletable
)
)
Hi,
Share the link from where i can download your PBI file.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Cumulative =
CALCULATE (
SUM ( 'Schedule'[Forecast] ),
USERELATIONSHIP ( CalendarM[Date], 'Schedule'[Forecasted Date] ),
FILTER (
ALLSELECTED ( 'CalendarM' ),
CalendarM[Date] <= MAX ( CalendarM[Date] )
&& CalendarM[Year] = MAX ( CalendarM[Year] )
)
)
For example, in the schedule table, 7if we don't have any June dates in the Forecasted Date, how can we calculate a culmulative value without skipping June?
Forecasted DateForecast
| Sunday, 1 May 2022 | 5 |
| Friday, 1 July 2022 | 3 |
| Monday, 1 August 2022 | 4 |
| Thursday, 1 September 2022 | 7 |
| Saturday, 1 October 2022 | 6 |
| Tuesday, 1 November 2022 | 9 |
Hi,
Thank you for your feedback.
Please check the below if it suits your requirement.
-Jun value shows in the table visualization
-only upto Nov values are shown.
Cumulative =
VAR _lastdateinscheduletable =
CALCULATE ( MAX ( Schedule[Forecasted Date] ), REMOVEFILTERS () )
RETURN
CALCULATE (
SUM ( 'Schedule'[Forecast] ),
USERELATIONSHIP ( CalendarM[Date], 'Schedule'[Forecasted Date] ),
FILTER (
ALLSELECTED ( 'CalendarM' ),
CalendarM[Date] <= MAX ( CalendarM[Date] )
&& CalendarM[Year] = MAX ( CalendarM[Year] )
&& MIN ( CalendarM[Date] ) <= _lastdateinscheduletable
)
)
This answer has helped resolve my question too. Much appreciated! Now I'm trying to get a new measure for calculating the running total of previous year in same way. Could you provide some guidance? Thank you
It worked! Amazing!
Many thanks for your help!
Thanks for the suggestion.
My problem is that I created a 10 year calendar that link to the dates in the schedule table. While the schedule table only runs to a certain month in 2023. I want the running total to add up to the last date on the schedule table instead of the calendar table.
Sure. I created a ten year calendar table called calendarM (2020-2030) and linked it to my fact table schedule. Calendar M has date and month/year columns.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.