This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
I am looking for an M code for a calculated column.
The aim is to search for the value "Yes" in the Type column,
where the ID must be the same. If so, the value "Yes" must be displayed, otherwise a null value.
On the picture you see the two columns I have.
And the orange column is the calculated column I'm looking for.
Solved! Go to Solution.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci9KTc1T0lGKTC1WitVB8BOTU9JSwCJBqSlAvl8+EqeiOAWi2ikntRTINzQyBnPDMzJLUpEMg/GhmmFcpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"All", each _, type table [ID=nullable text, Type=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Measure", each if List.Contains([All][Type],"Yes") then "Yes" else null),
#"Expanded All" = Table.ExpandTableColumn(#"Added Custom", "All", {"Type"}, {"Type"})
in
#"Expanded All"
I would never have come up with this myself. Your example was already successful. Now I'm going to apply it to my actual data table.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci9KTc1T0lGKTC1WitVB8BOTU9JSwCJBqSlAvl8+EqeiOAWi2ikntRTINzQyBnPDMzJLUpEMg/GhmmFcpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"All", each _, type table [ID=nullable text, Type=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Measure", each if List.Contains([All][Type],"Yes") then "Yes" else null),
#"Expanded All" = Table.ExpandTableColumn(#"Added Custom", "All", {"Type"}, {"Type"})
in
#"Expanded All"
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |