Forum Discussion
return Yes or no from column
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
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
11 Replies
- amitchandak
Super User
tijuemson , use search that is not case sensitive
example of new column
if( search("Any word",Table[column],,0) >0, true(), false())
- amitchandak
Super User
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())
- nvprasad
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")Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂Regards,
N V Durga Prasad- tijuemsonFrequent Visitor
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
- PhilipTreacy
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
- tijuemsonFrequent Visitor
data is added thanks
i cant unpivot it because the data is in a funny way
- PhilipTreacy
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