Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in BI by (11.1k points)

Is there any way to modifie the code below

= Table.AddColumn(#"PreviousStep", "Tag", each 
     if Text.Contains([Column1]) = "value1" then "bingo" 
else if Text.Contains([Column1]) = "value2" then "bingo"
else if Text.Contains([Column1]) = "value3" then "bingo"
else ["Some other value"])

into code similar to SQL

case when [Column1] in ("value1", "value2", "value3") then "bingo" else "Some other value" end 

How can I do that? 

1 Answer

0 votes
by (22.5k points)

Use the following measure:

= Table.AddColumn(#"PreviousStep", "Tag", each if List.AnyTrue(List.Transform({"value1", "value2", "value3"}, (s) => Text.Contains([Column1], (s)))) then "bingo" else "Some other value")

Want to learn more about Power Bi, Refer & learn Power bi

Also, check out our YouTube video to know the data visualization basics and best practices with Power BI

 

Related questions

0 votes
1 answer
asked Mar 6, 2021 in BI by Chris (11.1k points)
0 votes
1 answer
asked Mar 7, 2021 in BI by Chris (11.1k points)
0 votes
1 answer
asked Nov 24, 2020 in BI by Chris (11.1k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...