Forum Discussion

Oggie's avatar
Oggie
Frequent Visitor
2 years ago
Solved

Automatic selection of filter value based on another dimension

I have created a graph that shows a benchmark that compares the KPI for a selected legal entity with other legal entities:

I am using the following code to change the color for the selected division

Highlight selected TS = 
if(
    ISFILTERED('Department copy') &&
    VALUES('dim_department'[legal_entity_name]) IN VALUES('Department copy'[legal_entity_name]),
    "Green", "Light Gray")

 The "Department copy"-table is a copy of "dim_department" which is setup only for this purpose, but there is no relationship between the tables since I don't want selections of "dim_department" to filter "Department Copy".

So far so good.... but I want a slicer of "dim_department" to automatically select the same legal entity in the slicer that gives the highlighted value (or any other solution apart from slicer).

I tried to do the following solution:

1. Create a measure to display selected value (works fine)

SelectedLegalEntity = SELECTEDVALUE('dim_department'[legal_entity_name])

 
2. Create a new column in "Department Copy" to decide which value that is selected. (Doesn't work... can't get any values from "SelectedLegalEntity". All rows in table shows "0".)

IsSelected = IF('department copy'[legal_entity_name] = [SelectedLegalEntity], 1, 0)

 
Next step was to add "IsSelected" to the visual filter with the condition "1".

Is this a viable solution? Where do I go wrong? Any other solution possible?


Best regards
Stefan