Forum Discussion

Domenico96's avatar
Domenico96
Helper I
2 months ago
Solved

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 wo...
  • Shai_Karmani's avatar
    2 months ago

    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 & AI

    Let’s connect on LinkedIn  | Work with me | Get Updates on the hottest  Fabric & Power BI news