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
iping
New Member

Filtering Data by containing string values

SampleIdea.gifFigure 1.0 - design screen above is shown of my report.

 

I collected data shown in the table for preference of colors - the results are shown eg. Red, Yellow for the participants in survey.

 

What I need to acheive:

The horizontal three colors at the top, as shown in the image above, when clicked shouold filter for all rows that contains the selected color.

  • The three (3) Colors at the top (horitonal layout) are an independant table that is created in the PowerBI,
  • The dataset with the color choices and participant ID are  stored in another table named the ColorDS. See figure 2.0

\Figure 2.0 the tables in the PowerBI

ColourDS.png

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @iping ,

 

Try this:

Measure 2 =
IF (
    SUMX (
        ColorTable,
        FIND (
            UPPER ( ColorTable[ChoiceList] ),
            UPPER ( MAX ( ColorsDS[Color Choice] ) ),
            ,
            0
        )
    ) > 0,
    1
)

filter.gif

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

4 REPLIES 4
iping
New Member

This is great.

Muchas Gracia.

Icey
Community Support
Community Support

Hi @iping ,

 

Try this:

Measure 2 =
IF (
    SUMX (
        ColorTable,
        FIND (
            UPPER ( ColorTable[ChoiceList] ),
            UPPER ( MAX ( ColorsDS[Color Choice] ) ),
            ,
            0
        )
    ) > 0,
    1
)

filter.gif

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@iping , On of the way is to split the values using power query into the rows.

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

 

Another way is use and independent slicer table to display color in the slicer and then use search or containsstring

measure =
var _max = selectedvalues(Color[Color])
return
calculate(countrows(colortable),filter(colortable,search(_max,colortable[Color],,0)>0))

 

refer: https://www.youtube.com/watch?v=mZt0HJw4gjQ

https://www.youtube.com/watch?v=XbgLGDvWdWQ

 

@amitchandak  Thank you for the idea and post. ✌️

The second method using the DAX is preferred. However, what I observe from your online videos for the search function, seem to be that it will only find the text string entered. My results are shown below.

The function work but it will return results only if it says  "Red" , while I am seeking to return a result where the work Red can be in  a line as follows eg - Green, Red, Yellow or Yellow, Red.

Will look into the ContainString function.


@amitchandak wrote:

@iping, On of the way is to split the values using power query into the rows.

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

 

Another way is use and independent slicer table to display color in the slicer and then use search or containsstring

measure =
var _max = selectedvalues(Color[Color])
return
calculate(countrows(colortable),filter(colortable,search(_max,colortable[Color],,0)>0))

 

refer: https://www.youtube.com/watch?v=mZt0HJw4gjQ

https://www.youtube.com/watch?v=XbgLGDvWdWQ

 



Webp.net-gifmaker (1).gif

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.