Search code examples
powerbidaxdata-analysispowerbi-desktopmeasure

Total row of my table : how to not Display my indicator?


_Hi, I have some trouble to not display my red indicator on the total of my "Negative consumption" table when it has only one row... Can anyone help me ? Thanks in advance. Here is the link of my pbix file


Solution

  • Use ISINSCOPE() instead.

    Count conso NEG LR = // Calcul du nombre de fois, par BAT, où la conso est négative
    
    VAR _NB_Conso_Neg =
    CALCULATE(
        COUNT('BDD Index'[Conso]),
        'BDD Index'[Conso] < 0 && 'BDD Index'[Bat] = SELECTEDVALUE(BAT[BAT]) && 'BDD Index'[Ordre TimeLine] = MAX('BDD Index'[Ordre TimeLine])
    )
    
    RETURN
    SWITCH(
        TRUE(),
        ISBLANK(_NB_Conso_Neg) && ISINSCOPE('Plans Comptages'[CPTc]), "🟢",
        NOT ISBLANK(_NB_Conso_Neg) && ISINSCOPE('Plans Comptages'[CPTc]),"🔴",
        ""
    )