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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |