Forum Discussion

EvaHello's avatar
EvaHello
Helper I
11 months ago
Solved

Conditional formatting - why isnt this working?

Hi all,

 

I did this before but cant see an edit option in conditional formatting to remind me how to do this.  Im trying to shade in a row

 

I have written this :

 

RowColor =
SWITCH(
    TRUE(),
    SELECTEDVALUE('Results (2)'[Level 1]) = "Net Revenue", "#D9D9D9",
    SELECTEDVALUE('Results (2)'[Level 1]) = "Net Revenue", 1,
   
    SELECTEDVALUE('Results (2)'[Level 1]) = "Gross Profit", "#D9D9D9",
    SELECTEDVALUE('Results (2)'[Level 1]) = "PBOP", "#D9D9D9",
    SELECTEDVALUE('Results (2)'[Level 1]) = "EBIT", "#D9D9D9",
    SELECTEDVALUE('Results (2)'[Level 1]) = "EBITDA", "#D9D9D9",
    SELECTEDVALUE('Results (2)'[Level 1]) = "Operating Profit", "#D9D9D9",
   
    BLANK()  
)
 
Then i go to the value in the field, click conditional formatting, but in the list, the 'row colour' option is shaded out.  So what should i do to apply this rule to the cell?
 
 
  • Row colour? You mean the background? 

    Then select Field Value from Format Style and select your measure

    If the measure is not selectable, it possibly because of this line:

    SELECTEDVALUE('Results (2)'[Level 1]) = "Net Revenue", 1,

    You are trying to return a value that is both a text and a number.  As what others have already pointed out, this line is redundant. The line above that supercedes it.

8 Replies

  • Might be due to this part, as you are assigning two values for same level

     

  • HI EvaHello 

     

    Try below Measure to remove the duplicated conditions.

    SWITCH(
    TRUE(),
    SELECTEDVALUE('Results (2)'[Level 1]) IN {
    "Net Revenue", "Gross Profit", "PBOP", "EBIT", "EBITDA", "Operating Profit"
    }, "#D9D9D9",
    BLANK()
    )



  • EvaHello seems like you have an issue with this like 

    SELECTEDVALUE('Results (2)'[Level 1]) = "Net Revenue"1,

    Try this 

    RowColor = 
    IF(
        SELECTEDVALUE('Results (2)'[Level 1]) IN {
            "Net Revenue", "Gross Profit", "PBOP", 
            "EBIT", "EBITDA", "Operating Profit"
        },
        "#D9D9D9",
        "#FFFFFF"
    )

     

  • Row colour? You mean the background? 

    Then select Field Value from Format Style and select your measure

    If the measure is not selectable, it possibly because of this line:

    SELECTEDVALUE('Results (2)'[Level 1]) = "Net Revenue", 1,

    You are trying to return a value that is both a text and a number.  As what others have already pointed out, this line is redundant. The line above that supercedes it.

  • Hi EvaHello,

    Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to danextianRoyelMasonMAmh2587, for those inputs on this thread.

    Has your issue been resolved? If the response provided by the community member danextian, Royel, MasonMA, mh2587, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Community Forum.

    • v-kpoloju-msft's avatar
      v-kpoloju-msft
      Community Support

      Hi EvaHello,

      Hope you had a chance to try out the solution shared earlier. Let us know if anything needs further clarification or if there's an update from your side always here to help.

      Thank you.

      • v-kpoloju-msft's avatar
        v-kpoloju-msft
        Community Support

        Hi EvaHellom,

        Just wanted to follow up one last time. If the shared guidance worked for you, that’s wonderful hopefully it also helps others looking for similar answers. If there’s anything else you'd like to explore or clarify, don’t hesitate to reach out.

        Thank you.