Forum Discussion

leerjones85's avatar
leerjones85
Frequent Visitor
1 year ago
Solved

Help with DAX Measure

Hi,

 

I have a table which has 4 columns

 

TitlePotentialFrequencyNearly
Example 1              410
Example 2         200
Example 3         411
Example 4100
etc....etc....etc....etc....

 

I want to be able to highlight any rows that have Potential = 4 as Yellow and if Frequency or Nearly = 1 then highlight Red.

 

I am getting stuck in creating a measure to do this, so that I can then use this measure as the rule in conditional formatting.

 

Any help is much appreciated.

 

  • leerjones85 

    Not sure if I I fully understand your question, try this and let me know:

    CF = 
    VAR __Case1 = CALCULATE( SUM(Table01[Value]) , Table01[Col] = "Potential") = 4
    VAR __Case2 = CALCULATE( SUM(Table01[Value]) , Table01[Col] = "Frequency" )  = 1
    VAR __Case3 = CALCULATE( SUM(Table01[Value]) , Table01[Col] ="Nearly" )  = 1
    VAR __Result = 
        SWITCH(
            TRUE(),
            __Case1, "yellow",         
            OR(__Case2, __Case3 )  , "red"
        ) 
    RETURN
        __Result

     



3 Replies

  • Hi leerjones85 
    You can achieve this by using conditional formating in cell elements option. Just select the series name from drowdown and set rules for backgroud color. See image:

     

     

     

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution and a kudos!!

     

     

    Best Regards,
    Shahariar Hafiz

  • Fowmy's avatar
    Fowmy
    Super User

    leerjones85 

    Not sure if I I fully understand your question, try this and let me know:

    CF = 
    VAR __Case1 = CALCULATE( SUM(Table01[Value]) , Table01[Col] = "Potential") = 4
    VAR __Case2 = CALCULATE( SUM(Table01[Value]) , Table01[Col] = "Frequency" )  = 1
    VAR __Case3 = CALCULATE( SUM(Table01[Value]) , Table01[Col] ="Nearly" )  = 1
    VAR __Result = 
        SWITCH(
            TRUE(),
            __Case1, "yellow",         
            OR(__Case2, __Case3 )  , "red"
        ) 
    RETURN
        __Result