0
votes

I'm trying to get a PowerBI slicer to show only the data that matches a substring.

The Slicer; which is pulled from a different table than the main dataset. (also I've created a Measure to tell me what value is selected.)

enter image description here

A data snipped below. For instance if I select "CONS" only the highlighted data should appear as it contains the string CONS based on the active Measure (slicer value).

enter image description here

However it seems my calculated column "isDisc" always returns 1. I've tried FIND, SEARCH, and CONTAINSSTRING all with the same results (everything is always true or 1).

this is the formula for "isDisc"

isDisc = FIND('Data Literacy'[Measure 2],'Data Literacy'[Target Discipline])

I'm not sure what fundamental concept I am missing, but any help is appreciated!

1

1 Answers

1
votes

We can use measure instead of CalculatedColumn. CalculatedColumn and CalculatedTable are calculated once at refresh time.

OnlySelected = 
var __slicer = SELECTEDVALUE('Tabela 2'[Target Discipline])
var __currentRow = SELECTEDVALUE(Test1[Target Discipline])
return
IF( find( __slicer, __currentRow,1,FALSE()),1,0)

enter image description here