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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
nabraham623
Regular Visitor

Return True or False if one row from column B contains a certain string for all values of column A

In this example I am trying to return true or false in column C based on whether one of the rows in column B contains the string "white" within a larger string for all distinct values within column A. 

 

BC
123redwhitegreenTrue
456yellowpurpleFalse
123redblueTrue
456blueblackFalse
123greenblueTrue
456redblackFalse
789whitesilverTrue
   
4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @nabraham623 ,

 

Please try:

Measure = 
var _a = COUNTROWS(FILTER(ALL('Table'),[A ]=SELECTEDVALUE('Table'[A ])&&CONTAINSSTRING([B],"white")))
return _a>0

Final output:

vjianbolimsft_0-1685345192479.png

Best Regards,

Jianbo Li

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

tackytechtom
Super User
Super User

hi @nabraham623 ,

 

How about this:

tackytechtom_0-1683609190292.png

 

 

Here the code for the measure:

Measure = 
IF (
    CALCULATE ( 
        CONTAINSSTRING ( 
            MAX ( 'Table'[B] ), "white" ), ALLEXCEPT ('Table', 'Table'[A] )
    ),
    true,
    false
)

 

Let me know, if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Doesn't look like all distinct values of Column A received a TRUE from my end when they should have.

Hi @nabraham623,

 

Please could you share the data and the screenshot showing which ones do not receive a true though they should have?

 

Thanks

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.