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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Marcelo_Koboldt
Frequent Visitor

Filter single value in slicer from multiple values inside string

Hi guys,

 

I am having a hard time in trying to figure out how to filter a value inside a string based on a single value slicer selection with DAX. I know I can get my job done in M with pivoting some data but I also think that it is possible to do this with DAX. 

 

For example, let me post an image to best show my issue:

Marcelo_Koboldt_0-1666886557712.png 

Marcelo_Koboldt_1-1666886603101.png

 

So, basically what I want is to select 'cleaning' in the slicer and it will select the rows with 'cleaning' on it. 

(just for curiosity, I am using it in a map visual so that if I select cleaning it will only shows services which have 'cleaning' on it)

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Marcelo_Koboldt ,

 

Try like below:

Find =
VAR sel =
    SELECTEDVALUE ( Slicer[Slicer] )
VAR find_ =
    SEARCH ( sel, MAX ( 'Table'[Data] ),, -1 )
RETURN
    IF ( find_ <> -1, 1, 0 )

vhenrykmstf_0-1666945960172.png

vhenrykmstf_1-1666945981291.pngvhenrykmstf_2-1666945994342.png

 

If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Marcelo_Koboldt ,

 

Try like below:

Find =
VAR sel =
    SELECTEDVALUE ( Slicer[Slicer] )
VAR find_ =
    SEARCH ( sel, MAX ( 'Table'[Data] ),, -1 )
RETURN
    IF ( find_ <> -1, 1, 0 )

vhenrykmstf_0-1666945960172.png

vhenrykmstf_1-1666945981291.pngvhenrykmstf_2-1666945994342.png

 

If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Thank you so much! 

 

It is working perfectly fine. Just for curiosity, why did you use MAX () inside of SEARCH?

I'm still learning and mastering the use of Variables inside DAX and trying to get used to everything in it.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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