Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi, Im fairly new to Power BI and I'm struggling to work out how to avoid my cumulative/YTD running total line graph dipping back down to zero when I don't have any values in a particular month. It should stay at the previous months YTD figure.
My current measure is as follows:
YTD Cumulative = calculate([Total Agreements],FILTER(ALLSELECTED (agreements),([executiondate] <= MAX(agreements[executiondate]))),GROUPBY('Date','Date'[Fiscal Year]))
where Total Agreements = if(COUNTROWS(agreements) = BLANK(), 0, COUNTROWS(agreements))
The graph currently looks like this:
As you can see the line at Dec 2016 dips back down to zero (because there were no occurances in that month) before going back up in January, but it should stay as a horizontal line in reality as the YTD total remains the same.
I did have Total Agreements = COUNTROWS(agreements), but that gave me a broken line graph (which is also wrong), hence the addition of the IF statement.
If it is important to know, the data is coming from Dynamics.
Any thoughts would be very gratefully received.
Thanks!
Hi @Anonymous,
Please try this:
Total Agreements = COUNTROWS(agreements)
YTD Cumulative =
IF (
COUNTROWS ( agreements ) = BLANK (),
CALCULATE (
[Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
(
MONTH ( [executiondate] )
<= MONTH ( MAX ( agreements[executiondate] ) ) - 1
)
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
),
CALCULATE (
[Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
( [executiondate] <= MAX ( agreements[executiondate] ) )
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
)
)
Regards,
Yuliana Gu
Hi there @v-yulgu-msft,
Thanks for looking into this problem for me, but unfortunately that doesn't seem to be working as that gives me a broken line for that missing month.
I created 2 new measures called v2Total Agreements & v2YTD Cumulative (rather than changing my current ones) and this is how the graph now looks and I created a table to show the actual figures for my original measures and the new ones:
As you can see there is no figure for v2YTD Cumulative for December Fiscal Year 2016, I'm trying to get it to say 21 (which is the same figure for November).
Really appreciate you looking into this for me.
Just to confirm here is the new measure created:
v2YTD Cumulative =
IF (
COUNTROWS ( agreements ) = BLANK (),
CALCULATE (
[v2Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
(
MONTH ( [executiondate] )
<= MONTH ( MAX ( agreements[executiondate] ) ) -1
)
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
),
CALCULATE (
[v2Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
( [executiondate] <= MAX ( agreements[executiondate] ) )
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
)
)
Thanks,
Andy