Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stchln
Resolver I
Resolver I

Dynamic filtering a column containing several keywords

Hello,

I think I need your help on a filtering I would like to do.

 

I have a table TP, simplified, as below. It contains a column P with some references and a column L containing a list of tags. Why I would like to do is to create a dynamic filter table in which I could just click on one of the tags that would filter the list of references in table TP

 

My first step : to be able to create a table of tags that I could use as filter

 

TP is the initial table 

PL
P1AA,BB
P2BB
P3 

 

After creating a 1st table, named TPS, split of table TP by column L with option by Rows I get a table as below

PL
P1AA
P1BB
P2BB
P3 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjBU0lFydNRxclKK1QFyjYBcGNsYyFaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [P = _t, L = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"P", type text}, {"L", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"L", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "L"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"L", type text}})
in
    #"Changed Type1"

 

Then, from TPS, I build a 3rd table of possible tags, named TF just by removing other columns as explained in post (LINK)

F
AA
BB

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjBU0lFydNRxclKK1QFyjYBcGNsYyFaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [P = _t, L = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"P", type text}, {"L", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"L", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "L"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"L", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"P"})
in
    #"Removed Columns"

 

Then, I create a model with relationships between TP.P and TPS.P (n to 1) using L column as Key and a second relationship between TPS.L and TF.F (n to 1) using L/F as a key

 

stchln_0-1601702903160.png

 

At this point, if I create a display with the three tables in same page, when I click on a row of table TF this is filtering correctly in table TPS (where I have the split) but nothing happens for the initial table TP. Somethink like there is no transitivity...

--> This is second problem I am trying to solve... with your help

 

Tables with filtering

stchln_1-1601703415297.png

 

If I select in table TF row containing AA, selecting correctly applies on table TPS but nothing happens on table TP...

stchln_2-1601703512149.png

 

Thanks for your help!

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi

I found a solution on

- remove all relationships

- create a measure attached to TP

Measure = SEARCH(
    SELECTEDVALUE(TF[L]),
    SELECTEDVALUE(TP[L]),
    ,-1
)

- Add a slicer with Measure greater than or equal to 1

stchln_0-1601786004456.png

View solution in original post

3 REPLIES 3
HotChilli
Super User
Super User

Get rid of table TP from the finished model - it's redundant.

 

If you want a table visual that represents a filtered table TP then build it from TPS (probably using CONCATENATEX in a measure to build the string)

Hi

I found a solution on

- remove all relationships

- create a measure attached to TP

Measure = SEARCH(
    SELECTEDVALUE(TF[L]),
    SELECTEDVALUE(TP[L]),
    ,-1
)

- Add a slicer with Measure greater than or equal to 1

stchln_0-1601786004456.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.