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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tijuemson
Frequent Visitor

return Yes or no from column

Download data here 

 

So i am in a pickle

i have to find certain customers from a survey results if they fill anything like sucidal or self harm and i need to flag it.

 

so i used containsstring to find out if those words are there or not

 

Now i need a code to return "True" if any row value in that column contains "true" 

 

if all the row values in the column is false then "false"

 

can anybody help 

 

adding data here

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @tijuemson 

This Measure will work, but you haven't provided actual data to test against.

 

Measure = MAX('Table'[Column1])

 

Doing a MAX on a text column will return "True" if it exists anywhere, otherwise you will get "False".  T comes after F in the alphabet.  This is assuming the column can only contain "True"or "False" as you described.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

11 REPLIES 11
PhilipTreacy
Super User
Super User

Hi @tijuemson 

This Measure will work, but you haven't provided actual data to test against.

 

Measure = MAX('Table'[Column1])

 

Doing a MAX on a text column will return "True" if it exists anywhere, otherwise you will get "False".  T comes after F in the alphabet.  This is assuming the column can only contain "True"or "False" as you described.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


data is added thanks

 

i cant unpivot it because the data is in a funny way

Hi @tijuemson 

Please be as clear as you can about the data you are working with and the desired result.  As you can see from the variety of answers you've received, we're all guessing to some extent as to what your data looks like and what you want.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thx @tijuemson 

So that's the Excel file but you saisd you already brough the data into PBI and wrote some DAX to create a column containing either True or False ?

Have you tried the Measure I provided?

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


i just copied that file from the powerbi to excel.

the red alert table  is a created column with containsstring

 

and yes i tried the formula but it returns False eventhough there is true in there

Hi @tijuemson 

Any chance you can provide your PBIX file?  I just loaded that data from Excel into PBI and my measure works correctly - download this PBIX file to check.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi Phil thanks for the help

i just converted the red alert one(which was in true/false) to Text and it works now

 

thank you so much

nvprasad
Solution Sage
Solution Sage

Hi,

 

Please try with the below dax funtion.

 

Check =
IF (
OR (
CONTAINSSTRING ( Survey[Response], "sucidal" ),
CONTAINSSTRING ( Survey[Response], "self harm" )
)
= TRUE (),
"True",
"False"
)
Survey dax.PNG
 

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

Did I answer your question? Mark my post as a solution! Appreciate your Kudos.
Follow me on LinkedIn.

Hi Prasad,

 

I have done this part.

but now i want to add this to the report.

 

but since i am doing columnwise it only shows the first or last value

 

but i want to return True even if atleast one true is there

 

and if all are no then no

 

thanks

amitchandak
Super User
Super User

@tijuemson , use search that is not case sensitive

example of new column

if( search("Any word",Table[column],,0) >0, true(), false())

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@tijuemson , for that you need a new column like , this will have same status for a id, say survey id

if(isblank(maxx(filter(Table,[survey id] = earlier([survey id]) && [Flag] = true()),[survey id])), false(), true())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors