Forum Discussion

claxxx's avatar
claxxx
Frequent Visitor
2 years ago

Conditionnal formating with 2 Calculation group

Hello All,

I'm trying to apply a conditionnal formating to a table where I have 2 Calculation Group:

- One with my measures 

- One with Time variation (actual, p-1, and var %)

 

I want to apply a conditionnal formating to my column "VAR %" and only this one. I want the variation to be red if it's negative and green if positive (and an other of my problem is that i want the reverse for the measure "Cost per Sales" ie: red if positve, green if negative). 

 

In order to do that i've created the measure Conditional Color like that:

CONDITIONAL COLOR = if(SELECTEDVALUE('TIME VAR'[Variation]) IN {"ACTUAL","P-1"},BLANK(),1)
 
It works fine when I just put 1 measure alone, but when I add my Calculation Group with All my Measures it ignore totally my conditional formating. 
 
Do you know how to solve that?
 
I've try to replicate my data issue in a specific file pbi , i join it here:  https://we.tl/t-Wp4SMWbxuS 

 

Thank you for your help

 

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi claxxx ,

    If I understand correctly, the issue is that you want to apply a conditional formatting to make the positive is red and the negative is green. Please try the following methods and check if they can solve your problem:

    1.Create a measure. Enter the following DAX formula.

     

    Measure = 
    var _persales = SELECTEDVALUE('MESURE GROUP'[Mesure])
    var _salesvar = SELECTEDVALUE('TIME VAR'[Variation])
    RETURN
        IF (
            _salesvar IN {"ACTUAL", "P-1"},
            BLANK(),
            IF (
                _persales = "Cost per Sales" && _salesvar = "VAR",
                BLANK(),
                1
            )
        )

     

    2.Select the INIT KPI values and choose the conditional formatting.

    3.Select the measure and set the Rules.

     

     

    4.The result is shown below.

     

    Best Regards,

    Wisdom Wu

     

     

     

    • claxxx's avatar
      claxxx
      Frequent Visitor

      Thank you for your answer. 

      My point was principally to apply a conditionnal formating only to the "VAR %" column. 

      So for all measures the column "Actual" and "P-1" should maintain without any color, and VAR % have to be the only column with a conditionnal color. 

      In your result I see that the 3 column "Actual", "P-1", and "VAR %" have the conditional format but I just want VAR % to have it. Do you have a solution to do that?