Forum Discussion

NILU090's avatar
NILU090
Icon for Helper II rankHelper II
3 years ago
Solved

conditional formatting to 1 row in metrix

Hi team,

As provided input and output following. I need to apply conditional formatting to only plan.

if actual - plan is negative then red & if its positive then green.

I have created this in metrix. please guide me on this.

 

 

Regards,

Narendra

  • Anonymous's avatar
    Anonymous
    3 years ago

    HI NILU090,

    You can use conditional formatting with expression mode to use Dax formula as format rules:

    Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

     

    formula =
    VAR currAttribute =
        SELECTEDVALUE ( Table[Attribute] )
    VAR result =
        CALCULATE (
            SUM ( Table[Value] ),
            ALLSELECTED ( Table ),
            VALUES ( Table[Attribute] ),
            VALUES ( Table[Date] )
        )
    RETURN
        IF ( currAttribute = "Plan", IF ( result > 0, "Green", "Red" ), "Black" )

     

    Regards,

    Xiaoxin Sheng

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI NILU090,

    You can use conditional formatting with expression mode to use Dax formula as format rules:

    Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

     

    formula =
    VAR currAttribute =
        SELECTEDVALUE ( Table[Attribute] )
    VAR result =
        CALCULATE (
            SUM ( Table[Value] ),
            ALLSELECTED ( Table ),
            VALUES ( Table[Attribute] ),
            VALUES ( Table[Date] )
        )
    RETURN
        IF ( currAttribute = "Plan", IF ( result > 0, "Green", "Red" ), "Black" )

     

    Regards,

    Xiaoxin Sheng

  • hi,

    i wanted to deduct actual from plan. If answer is negative then apply green color & if its positive apply red colour. ex JAN month - 70 actual, 94 plan.. we cant reach to plan amount so it should red