Power BI: display table result containing key word based on main value filter

Most of the time, columns have multiple values but it may happen that one of those columns are linked to my filter and this filter, only contains main criterias so not all values of the columns. May be, I am not very clear so for instance, I have this table and this slicer:

power bi

The slicer only contains the main values which are DB, NT and UX but if I select UX, my table will show only UX:

power bi

It doesn’t display the INC003 and INC006, as we can see, both contain UX in the “support” column. As you may guess, what I want is that if I select UX, I want to see all UX and not some of them. To get the desired result, there are 2 important things to do:

  • Create a new measure telling it to look for all main criteria for the table
  • Delete or de-activate the relationship

For the measure, the formula:

SEARCH(SELECTEDVALUE('table1'[argument]),SELECTEDVALUE('table2'[argument]),,0)

NOTE: if it is numbers that include 0 instead of words, change 0 by -1.

power bi

Put it in the “filters” panel (not in the “visualizations” panel) of the table and configure/select as shown in the picture:

power bi

Next, I need to delete or de-activate the relationship so now, if I select back UX, I got all results

power bi

But the counting is showing 10 instead of 5, this is because I remove the relationship. To remediate it, I will need to do some changes, first the filter, I will add “all” then for the selection, use “single select”:

power bi power bi

I will add a new column to include “all” in the support like that:

power bi

In the first measure, I will put the new column:

power bi

And at last, I will create a new measure with this formula:

CALCULATE(COUNT('table1'[argument1]),CONTAINSSTRING('table1'[argument2],VALUES('table2'[argument])))

power bi
power bi

Interesting Topics