Forum Discussion

y_s_c's avatar
y_s_c
Frequent Visitor
2 years ago
Solved

Conditional formatting stops working when using slicer

Hi there,

 

I've got a matrix with some basic measures that display calculated percentages for, say, a bunch of companies in different geographies. The matrix uses condititional formatting to colour the cells' backgrounds based on another measure used for the field value formatting.

 

The measure I'm using for the field value formatting style looks something like:

 

 

EU companies colour formatting =
IF (
    [EU companies %] = BLANK (),
    "",
    IF (
        [EU companies %] < [Total %],
        "#feb5b1",
        IF ( [EU companies %] > [Total %], "#cee2cd" )
    )
)

 

 

Then if I add a slicer to the page to filter by companies (e.g., EU companies, US companies, African companies) the colour formatting disappears for the selected company-type, i.e., if I select EU companies the colour formatting stays for the rest of companies but disappears for the column showing the calculated percentages for EU companies.

 

Could someone please explain this behaviour to me? Any and all help very much appreciated!

 

EDIT: the colour formatting remains if the slicer filters for something else other than geography (e.g., size of company). Filtering using any variable used in the creation of the measure [EU companies %] results in the formatting disappearing.

  • Hi y_s_c 

     

    I think the issue is caused by the ALL(Table1[Something]) in the measures.

     

    Can you tell me the bahaviour you would like to acheive in the visual?

    Example when you filter Europe what do you want to see? Do you want the colour formatting to Jump to Europe, but still see all the other continents?

     

    The colour coding logic doesn't make sense, you will always have less than All and Never More than all. Is there a % value that we can measure against?

     

    Asia colour formatting = 
    IF (
        [Asia %] = BLANK (),
        "",
        IF (
            [Asia %] < [All],
            "#feb5b1",
            IF ( [Asia %] > [All], "#cee2cd" )
        )
    )

     

     

     

     

     

     

     

     

     

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, y_s_c 

    Didn't simulate your problem, you can share pbix files without sensitive data for testing.

    Best Regards,
    Yang
    Community Support Team

    • y_s_c's avatar
      y_s_c
      Frequent Visitor

      Sorry, thought I was missing something obvious that wouldn't require an example file. My bad.

       

      Here I recreated the issue with a very simple and small example: https://we.tl/t-EhaDwWc50t

      There's one table with data and one table with measures. If you use the slicer for "Continent", the column with the selected continent loses the colour formatting. Probably the answer to my question is rather simple and one of those "facepalm" moment, haha.

       

      Thanks!

      • Joe_Barry's avatar
        Joe_Barry
        Solution Sage

        Hi y_s_c 

         

        I think the issue is caused by the ALL(Table1[Something]) in the measures.

         

        Can you tell me the bahaviour you would like to acheive in the visual?

        Example when you filter Europe what do you want to see? Do you want the colour formatting to Jump to Europe, but still see all the other continents?

         

        The colour coding logic doesn't make sense, you will always have less than All and Never More than all. Is there a % value that we can measure against?

         

        Asia colour formatting = 
        IF (
            [Asia %] = BLANK (),
            "",
            IF (
                [Asia %] < [All],
                "#feb5b1",
                IF ( [Asia %] > [All], "#cee2cd" )
            )
        )

         

         

         

         

         

         

         

         

         

  • Hi y_s_c 

     

    Can you share how you created both measures? Are both measures calculated from the same table? If not, do both tables share the same dimensions?

     

    As Anonymous  mentioned, if you could share a PBIX or provide more information on your data structure. Relationships, Measures etc, this will help us find you a solution

     

    Joe

    • y_s_c's avatar
      y_s_c
      Frequent Visitor

      Yeah, my bad. I replied to v-yaning-msft below with an example file. Thanks!

    • ytkweh123's avatar
      ytkweh123
      New Member

      Hi there,

       

      I encountered a similar issue by applying conditional formatting using measures and when I slice the data by calculation group, the conditional formatting that was originally there disappeared for 1 of the measures. Does anybody know what is happening and how to solve this? The formatting works on a card visual with 1 measure but on a bar chart with 5 measures, it doesn't work when calculation group is applied. Other measures that uses the simple conditional formatting (not by measure) still works when calculation group is applied.

       

       

      Thanks!