Forum Discussion
Total % not showing correctly
Hi everyone, I have an issue with a measure.
The desired output is to show the normal value for each month (the one defined in the RETURN), while for the current month—when no date is selected—I would like to display the closing estimate (KPI_Stima).
With the current measure, if I put the month in the dimension, the values are displayed correctly. However, the total percentage variation is not correct: instead, it returns the percentage of the current month when no Calendar date is selected (in this case, June).
What I would like is to keep the monthly calculation as it is, but have the total percentage calculated correctly.
Could you please give me some advice ?
In this case, all the % are correct, but the total one is not. Instead of showing 55,1% ( the same value of june ) I should see something like ≈−34,1%
This is the DAX :
Hey
Your total row isn't a month, but MeseCorrente still fires there because MaxData grabs June, so the whole total drops into the KPI_Stima branch and copies June's 55,1%.Fix is simple. A % can't be summed across rows, so at the total you gotta rebuild it from the raw numbers, not reuse one month's value.
Quick patch, just kill the estimate branch at the total:
VAR IsTotale = NOT HASONEVALUE('Calendar'[Mese]) RETURN IF( NessunFiltroData && MeseCorrente && NOT IsTotale, KPI_Stima, SWITCH( ... your normal vs PY % ... ) )That gets the leak out, but now the total ignores the estimate completely.
If you want the total to actually count the estimate for June plus actuals for the other months, sum numerator and denominator separately, then divide once at the end:
VAR IsTotale = NOT HASONEVALUE('Calendar'[Mese]) RETURN IF( IsTotale, DIVIDE( total_current_or_estimate - total_PY, total_PY ), IF( NessunFiltroData && MeseCorrente, KPI_Stima, [normal vs PY %] ) )If it helped please mark as resolved & give a kudo.
Shai Karmani | Data, Analytics & AILet’s connect on LinkedIn | Work with me | Get Updates on the hottest Fabric & Power BI news
3 Replies
- Shai_KarmaniSuper User
Hey
Your total row isn't a month, but MeseCorrente still fires there because MaxData grabs June, so the whole total drops into the KPI_Stima branch and copies June's 55,1%.Fix is simple. A % can't be summed across rows, so at the total you gotta rebuild it from the raw numbers, not reuse one month's value.
Quick patch, just kill the estimate branch at the total:
VAR IsTotale = NOT HASONEVALUE('Calendar'[Mese]) RETURN IF( NessunFiltroData && MeseCorrente && NOT IsTotale, KPI_Stima, SWITCH( ... your normal vs PY % ... ) )That gets the leak out, but now the total ignores the estimate completely.
If you want the total to actually count the estimate for June plus actuals for the other months, sum numerator and denominator separately, then divide once at the end:
VAR IsTotale = NOT HASONEVALUE('Calendar'[Mese]) RETURN IF( IsTotale, DIVIDE( total_current_or_estimate - total_PY, total_PY ), IF( NessunFiltroData && MeseCorrente, KPI_Stima, [normal vs PY %] ) )If it helped please mark as resolved & give a kudo.
Shai Karmani | Data, Analytics & AILet’s connect on LinkedIn | Work with me | Get Updates on the hottest Fabric & Power BI news
- v-veshwara-msftCommunity Support
Hi Domenico96 ,
Thanks for reaching out to Microsoft Fabric Community.Just wanted to check if the response provided by Shai_Karmani was helpful. If further assistance is needed, please reach out.
Thank you. - v-veshwara-msftCommunity Support
Hi Domenico96 ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.