Forum Discussion

jvbs's avatar
jvbs
Helper I
6 years ago
Solved

Conditional Formatting using Total as Params

Hello everyone,

 

I need to implement a conditional formatting on this table where the FPD % cell is compared to it's total, like in the example below, where the 17,9% must be compared to 10,1% and, if it's bigger, paint it red.

 

 

Is it possible? I tried with a measure to use in comparison but no success 😞

  • Hi jvbs ,

     

    In your scenario, ALL is the key to achieve the goal.I have created a sample for your reference. 

    % FPD30 = 
    CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', 'Table'[val] = "y" ) )
        / CALCULATE ( SUM ( 'Table'[value] ) )
    
    Measure = 
    VAR a =
        CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', 'Table'[val] = "y" ) )
            / CALCULATE ( SUM ( 'Table'[value] ) )
    VAR b =
        CALCULATE (
            SUM ( 'Table'[value] ),
            FILTER ( ALL ( 'Table' ), 'Table'[val] = "y" )
        )
            / CALCULATE ( SUM ( 'Table'[value] ), ALL ( 'Table' ) )
    RETURN
        IF ( a >= b, "green", "red" )
    

     

    For more details, please check the pbix as attached. If it doesn't meet your requirement,  Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

     

     

5 Replies