Forum Discussion

Dilbertfan's avatar
Dilbertfan
Frequent Visitor
1 year ago
Solved

Highlight Table Rows from Selection in Another Table

Hi All

 

I have an issue with highlight rows in a table which I havent been able to find a suitable answer to from the various posts on highlighting rows using disconnected tables.

 

The Data

I have two tables - one for Employee and one for Topic, with a 1-Many relationship between them

 

    

 

The Ask

I would like to be able to select an Organisation which should show all of the disctinct topics for that organisation in a table and the employees in another table.  However, I would then like the user to be able to click on the employee name and for it to highlight the topics that they are interested in - something like the following layout.

 

So if Bob was clicked, Mental, Cycling and Yoga would be highlighted.  I dont want to use a filter on the Topic table (which would be the easy way out) as I want to see continually see all of the topics for the organisation.

 

I have tried various combinations of the suggestions by Goodly and Valerie Junk from YouTube, but to no available.

 

If necessary, I am happy for the name to be in a slicer visual, as I can use the tile slicer to add in their job description which I havent shown on the data table.

 

Hope this is enough information.  A sample pbix file is attached

 

Highlight Test File 

 

Thanks in anticipation for your help

 

Rich

  • SamWiseOwl's avatar
    SamWiseOwl
    1 year ago

    Dilbertfan  I had another think about this and tried to solve the exact thing you wanted.
    Now I don't know how scaleable this will be but I did get it working.

    First I created a measure that would read who the orginisation was and force every possible Topic they might have to show. To make this neat I deleted the column header and set the measure to return an empty string "".

    Then I read the row and checked which person had been clicked in the table and if their topic matched the row set it to yellow.

     

5 Replies

  • Hi Dilbertfan 

    I suggest this measure :

    IsSelectedEmployeeTopic =
    VAR SelectedEmp = SELECTEDVALUE(Employee[Emp ID])
    RETURN
    IF (
        MAX(Topic[Emp ID]) = SelectedEmp,
        1,
        0
    )

    with this formatting in Cell Elements :



     

    which should give you this result :

     

     

    Regards

    Antonio

    • Dilbertfan's avatar
      Dilbertfan
      Frequent Visitor

      Hi antfr99 

       

      Thanks very much indeed for taking the time to respond.

       

      This is a great solution, but not quite right for what I need.  This shows all the topics regardless of what organisation you select, but I want the topics to be filtered by the organisation., but then highlighted by the employee.

       

      However, I am definitely keeping this one in my back pocket for other use cases.  Love the simplicity of it.

       

      Rich

  •  

    Hi Dilbertfan 

     

    You need a second copy of the employee list and use this to read which Name the report user has clicked.

    Then change the colour based on a measure:

    Highlight row measure =
     VAR CurrSlicer = SELECTEDVALUE('Employee Table'[Selected Name]) --chosen person in slicer
     var filtTopics =
     CALCULATETABLE(VALUES(Topics[Topic]), Employee[Name] = CurrSlicer) --what hobbies does that person like

     RETURN
     IF(
        SELECTEDVALUE(Topics[Topic]) IN filtTopics --if current row in list then change colour
        ,"Yellow" --apply yellow or use hex codes to get specific colours #00FF00 would be green
     )
    • SamWiseOwl's avatar
      SamWiseOwl
      Super User

      Dilbertfan  I had another think about this and tried to solve the exact thing you wanted.
      Now I don't know how scaleable this will be but I did get it working.

      First I created a measure that would read who the orginisation was and force every possible Topic they might have to show. To make this neat I deleted the column header and set the measure to return an empty string "".

      Then I read the row and checked which person had been clicked in the table and if their topic matched the row set it to yellow.

       

      • Dilbertfan's avatar
        Dilbertfan
        Frequent Visitor

        Hi SamWiseOwl 

         

        Thanks very much for taking the time to respond - really appreciate it.

         

        Yes this works great and I understand the rationale behind the Force Measure.

         

        The only minor hiccup is that when you select a individual, say Sally in Tesco, if you then switch to Waitrose, the topics are blank until you click on Fred because it still thinks it should be based on Sally from Tesco who doesn't exist in Waitrose.  However, this is minor issue and similar to the slicer issue when values remain in another slicer

         

        Could this be used with a Button Slicer to select the employee rather than a table?

         

        Anyway, I can move forward with this now - so fanastic bit of help.  Going to have a lot of fun documenting the 2 measures ğŸ˜€

         

        Rich