cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Search a string based on a filter

Hi All,

 

I am trying out following scenario to search on a string based on a filter.

 

So i have a slicer which contains the name of the materials. Once i select one material i need to search that material on another string.

 

What i have tried is as follows

 

I have created following measure.

 

ITEM = if (ISFILTERED(MATERIALS[Material_Description]),VALUES(MATERIALS[Material_Description]),"xxxx")

 

Then i am searching this on another string in some other table and if the material is found within text i return 1. else 0

 

ISITEM = IF(ISERROR(SEARCH([ITEM],RULES_TAB[RULES])),0,1)

 

My question is search function is not taking [ITEM] as a string. Is there a solution for this

 

Regards,

Maddy

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Search a string based on a filter

@maddy

 

Did you create ISITEM as a calculated column? You need to create it as measure with following formula and drag it into table visual as below.

 

ISITEM = 
IF (
    ISERROR ( SEARCH ( [ITEM], CALCULATE ( MAX ( RULES_TAB[RULES] ) ) ) ),
    0,
    1
)

Search a string based on a filter_1.jpg

 

Best Regards,
Herbert

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Search a string based on a filter

@maddy

 

Did you create ISITEM as a calculated column? You need to create it as measure with following formula and drag it into table visual as below.

 

ISITEM = 
IF (
    ISERROR ( SEARCH ( [ITEM], CALCULATE ( MAX ( RULES_TAB[RULES] ) ) ) ),
    0,
    1
)

Search a string based on a filter_1.jpg

 

Best Regards,
Herbert

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Search a string based on a filter

Hi Herbet,

 

Yay!! Your Method works. Thanks a lot Herbet. Earlier the ISITEM was a calculated column. 

 

Thanks again for the solution. 

 

Regards,

Maddy

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors