0
votes

In Power BI, is there a way to have a DAX function that uses the value currently selected in a slicer that has independent data?

For example, if I have a table where each row is a customer, and I have a separate table with a list of colors (which doesn't have any logical join with the customers - it's just a list of colors) - is there a way to set it up so that when the slicer selects "Red", the customer's name will be shown as "Bob Smith Red", if the slicer selects "Orange", the customer's name will be shown as "Bob Smith Orange", etc.

1

1 Answers

1
votes

Yep. You can read the value of a slicer in with SELECTEDVALUE.

Color = SELECTEDVALUE ( SlicerTable[Color] )

Note that SELECTEDVALUE ( X ) is a shortcut for IF ( HASONEVALUE ( X ), VALUES ( X ) ).

Bear in mind that this will only work with measures, not calculated columns, since calculated columns are unaffected by any filtering (they are only computed once when the data loads).