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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Filter hundred of values

Dear Power BI users,

 

I have a filtering issues that needs your support:

The data I have looks like this:

ItemCategory
AX1; X3; X5
BX3; X5; X7
CX4; X8; X9
DX5; X8
EX11; X12
FX9; X5

 

Now I would like to see those Items that have "X3 or X5 or X7". In this case, item C & E will NOT appear.

What would be the way to do this effectively? Given that my actual data has hundred of categories need to be filtered.

 

Thanks a lot,

1 ACCEPTED SOLUTION

@Anonymous 

Hi 

I gave you a DAX code. You can not use it in power query side.
Please try following M code in power query.

if Text.Contains([Category] , "X3") or Text.Contains([Category] , "X5") or Text.Contains([Category] , "X7") then "True" else "False"

 Thank you.

View solution in original post

6 REPLIES 6
Dinesh_Suranga
Continued Contributor
Continued Contributor

@Anonymous 

Did you change table name and column name according to your data table?

Thanks

Anonymous
Not applicable

1.PNGHi @Dinesh_Suranga, yes I did. Would you help me to see what could be wrong with my queries as above? Thanks

@Anonymous 

Hi 

I gave you a DAX code. You can not use it in power query side.
Please try following M code in power query.

if Text.Contains([Category] , "X3") or Text.Contains([Category] , "X5") or Text.Contains([Category] , "X7") then "True" else "False"

 Thank you.

Anonymous
Not applicable

Sorry my bad, but when I tried it in DAX, it's still not return desirable outcome

manhuynguyen_1-1668435808543.png

So thank you very much, I'll accept this as a solution.

But when I tried in Power Query, it works perfectly.

manhuynguyen_2-1668435949234.png

 

Dinesh_Suranga
Continued Contributor
Continued Contributor

@Anonymous 

Hi,

Please try following DAX code.

Measure = CONTAINSSTRING( SELECTEDVALUE('Table'[Category]),"X3") || CONTAINSSTRING( SELECTEDVALUE('Table'[Category]),"X5") || CONTAINSSTRING( SELECTEDVALUE('Table'[Category]),"X7") 

Dinesh_Suranga_0-1668164842574.png

Then you can filter True values.

If this helps you to solve your issue. Please accept this as the solution.

Thank you.

 

Anonymous
Not applicable

Hi, 

 

I tried it but it showed error: "Token eof expected"

Could you send me your pbix file as an example for this?

 

I'd really appreciate it.

Best regards,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.