Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Conditional Formatting on a text field based on Slicer selections from a separate dataset

Hello,

 

I am trying to "highlight" the background of each item that falls under a specific category of a slicer.

The slicer however comes from a separate dataset i.e. the items come from one data table and the slicer/filter comes from another data table.

I created a relationship between both data tables in order to use the specific slicer.

 

Attached is a picture to give some context (sensitive info blocked out).

Is it possible to format the background (add colour) to specific lines under Description based on the slicer highlighted to the right?

Any guidance on this will be appreciated.

9 Replies

  • Anonymous sure, you can add a measure for the color and then use this measure in conditional formatting of the description, using field value

     

    Color = 
    IF ( SELECTEDVALUE ( TableSlicer[Column] ) = MAX ( Table[Column] ), "Red" )

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you both parry2k  and nandic for your responses.

       

      I am a novice at power bi so my explanations may not be the most concise.

       

      The data in the visual is linked to the data in the slicer by another table, i.e. there are 3 data tables, the one in the middle linking the *visual data* to *slicer data*. 

      The fields highlighted in the picture are text fields.

       

      Also, the data in the slicer is different from the data to be highlighted i.e. the Description column is different from what the Slicer (Core HT).

       

      Please let me know if any other information would be useful.

       

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

        Hi, Anonymous 

        Do you mean that these two tables are not directly related to each other?

        Is it convenient to show the view of the relationship between your table and the table (using the option insert photos)?

        Ex:

         

        Best Regards,
        Community Support Team _ Eason

  • nandic's avatar
    nandic
    Resident Rockstar

    Hi Anonymous ,
    There are 3 steps:
    1) created disconnected table - it will prevent slicer from filtering main list so you will be able to only highlight selected values
    2) create measure like this: 

    SelectedManager = IF(SELECTEDVALUE('Manager (2)'[Manager Name]) = MAX(Manager[Manager Name]),1,0)
    *I am using manager slicer in my demo, table Manager is original, table Manager 2 is disconnected table
    3) assign background color conditional format based on this measure
    Full description and steps: https://stackoverflow.com/questions/59930844/highlighting-with-slicer-power-bi