Forum Discussion

Back2Basics's avatar
Back2Basics
Resolver I
4 years ago
Solved

Maxtrix conditional formatting

I have a matrix that is using data from two tables. Both tables have two columns; 'Unique ID' plus either 'Action' or 'Outcome'.

Both of the tables have multiple rows per ID as each Id can have many actions or outcomes. I then have a third table with all one of each ID and relationship set up.  

 

The maxtrix then plots the actions against outcome, with the count of ID (from the table with just ID's) as the value. This works fine.

 

What I would like to do is to have a slicer, or table if this is better, for the Unique ID - so that when selected the table values don't change but the matrix value backgrounds change colour to show the relevant parts of the matrix for that Unique ID. 

 

eg. 

 

 outcome Aoutcome Boutcome Coutcome D
action A

5

6115
action B16123
action C12037

 

then when an ID selected from the slicer/table it would show (I'd like background colour but used text colour in the example due to the options available for posting this):

 

 outcome Aoutcome Boutcome Coutcome D
action A

5

6115
action B16123
action C12037

 

I have tried a couple of things with conditional formatting but can't get this to work. Anyone done this before?

  • Hi Back2Basics ,

     

    Believe that for this case you need to create a unrelated table with the unique ID's then you need to create a measure similar to this one:

    Condittional formatting = IF(SELECTEDVALUE(SlicerID[ID]) in VALUES(UniqueID[ID]), 1)

     

    Now on the condittional formating select rule and value equal 1 should give something similar to:

     

     

     

     

  • MFelix's avatar
    MFelix
    4 years ago

    Hi Back2Basics ,

     

    That is related with the fact that probably those lines include all values on the slicer.

     

    Try to change your measure to:

     

    Condittional formatting =
    IF (
        ISFILTERED ( SlicerID[ID] ),
        IF ( SELECTEDVALUE ( SlicerID[ID] ) IN VALUES ( UniqueID[ID] ), 1 )
    )

     

    This will make sure you have selections on the slicer.

8 Replies

  • Hi Back2Basics ,

     

    Believe that for this case you need to create a unrelated table with the unique ID's then you need to create a measure similar to this one:

    Condittional formatting = IF(SELECTEDVALUE(SlicerID[ID]) in VALUES(UniqueID[ID]), 1)

     

    Now on the condittional formating select rule and value equal 1 should give something similar to:

     

     

     

     

    • Back2Basics's avatar
      Back2Basics
      Resolver I

      Thanks MFelix this is great. One thing that is a little annoying is that the matrix has a default formatting, with seemingly random cells getting the background - but works perfectly once the slicer has been selected. 

  • Hi MFelix 

     

    I succesfully used this, as I've said, in a report - worked perfectly. However, the report became corrupted and I had to start again. I did exactly the same, everything is as your suggestion - but for some reason the conditional formatting will not function this time round. 

    It's not essential that the report has this but it is a very useful function. Do you know of any reason, or setting, that might mean this wouldn't work for one report when it does work in an identical report?

    • MFelix's avatar
      MFelix
      Super User

      Hi Back2Basics,

       

      The questions here can be of context or filtering. But without any specific information is difficult to pin point.

      Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

      If the information is sensitive please share it trough private message.