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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
dass6
Regular Visitor

Check whether an ID has two specific values in another column

Hi All,

I am currently trying to create a calculated table which will only show those entries(has multiple entries) when a certain condition  is met.

 

dass6_0-1734568612967.png

Any WON which is repeated (3/4/5) if has a Text "C-I" will take the first priority. "C-R" will take the next priority and any text which starts with "EE" will take the last priority.

 

Final output table should have below entries only:

 

dass6_1-1734568844724.png

Any inputs will be greatly appreciated !!!

1 ACCEPTED SOLUTION

you can try this in PQ

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLW9VSK1YlWMgazg5DYCHFXV11DAwMw1wRJmQlEyggqZYokZQqRMoZKmUG4piBuLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WON = _t, TEXT = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"WON", Int64.Type}, {"TEXT", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"WON"}, {{"COMBINE", each Text.Combine([TEXT],","), type nullable text}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if Text.Contains([COMBINE], "C-I") then "C-I" else if Text.Contains([COMBINE], "C-R") then "C-R" else [COMBINE]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"COMBINE"})
in
#"Removed Columns"

 

11.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

not clear about the logic. Do you mean we only consider continous WON? that's why we have C-1 for 1 and 3?

The for EE 100,200 ,300 , we don't need these TEXT? why we will remain the 500?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu ..if a particular WON has multiple texts, then the priority will be given to C-I first, and if C-I is not present then C-R will get the next priority and last would be anything starting with EE

you can try this in PQ

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLW9VSK1YlWMgazg5DYCHFXV11DAwMw1wRJmQlEyggqZYokZQqRMoZKmUG4piBuLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WON = _t, TEXT = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"WON", Int64.Type}, {"TEXT", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"WON"}, {{"COMBINE", each Text.Combine([TEXT],","), type nullable text}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if Text.Contains([COMBINE], "C-I") then "C-I" else if Text.Contains([COMBINE], "C-R") then "C-R" else [COMBINE]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"COMBINE"})
in
#"Removed Columns"

 

11.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.