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
benson
Regular Visitor

Use single value to filter a row which combines multiple values

Rows need to filter

A
A,B,C
B
D
B,C,D
A
B

 

If use put above column to filter, it will list(A;  A,B,C;  B; D; B,C,D; )

What I want to see in fitler is 

expected filter

A
B
C
D

When I select A, should list, A; A,B,C; A

 

What I do currently is to create a fitler table. 

remove value duplicate -> copy value -> split value to new lines

value value filter

AA
A,B,CA
A,B,CB
A,B,CC
BB
DD
B,C,DB
B,C,DC
B,C,DD

 

Question is: I think my method is not good.. Is there any other better and easier way to hanle this?

2 ACCEPTED SOLUTIONS
Vera_33
Resident Rockstar
Resident Rockstar

Hi @benson 

 

When you say filtering A, you are talking about using Slicer to filter, and you need a DAX measure to display the reulst in a Card visual? If yes, two disconnected tables, one is filterTable in Slicer, one is rowTable. If you need to keep the original order, add an index column in Power Query

 

Vera_33_0-1626421475618.png

 

test = 
VAR CurFilter = SELECTEDVALUE(filterTable[Column1])
VAR T1=
ADDCOLUMNS(rowTable,"check",IF(SEARCH(CurFilter,rowTable[Column],1,-1)=-1,0,1))
RETURN
CONCATENATEX(FILTER(T1,[check]=1),[Column],";")

 

View solution in original post

CNENFRNL
Community Champion
Community Champion

Screenshot 2021-07-16 105207.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hi @benson ,

 

Go to query editor>duplicate the column>split the new column by delimiter(,):

vkellymsft_0-1626684932074.png

And you will see:

vkellymsft_1-1626684966042.png

 

No need to create a new table or dax expression.

Check my sample .pbix file attached.

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

CNENFRNL
Community Champion
Community Champion

Screenshot 2021-07-16 105207.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

thank you so much for your answer. i have already tried your way, but it only works for table visualization. what if i want to apply it to pie chart or bar chart? is there any other way i can do?

This is what I'm doing now. but due to I have many other column in this table. So split to new row will impact other data. So I have to create new table. 

Hi  @benson ,

 

Thus create a slicer table is much better,have you checked the solutions above,are they what you need?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Vera_33
Resident Rockstar
Resident Rockstar

Hi @benson 

 

When you say filtering A, you are talking about using Slicer to filter, and you need a DAX measure to display the reulst in a Card visual? If yes, two disconnected tables, one is filterTable in Slicer, one is rowTable. If you need to keep the original order, add an index column in Power Query

 

Vera_33_0-1626421475618.png

 

test = 
VAR CurFilter = SELECTEDVALUE(filterTable[Column1])
VAR T1=
ADDCOLUMNS(rowTable,"check",IF(SEARCH(CurFilter,rowTable[Column],1,-1)=-1,0,1))
RETURN
CONCATENATEX(FILTER(T1,[check]=1),[Column],";")

 

This also need create another table, is there any method that not use new table? 

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.

Top Solution Authors
Top Kudoed Authors