Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Greetings,
I have records grouped by a parent ID. I want to only return the grouped items that do not have a Active = "Current" in the group of records.
In the example below, I do not want the top for records (which have a unique parent ID). I want the last three since there is no Active = "Current" (these have another unique parent ID)
thanks
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("i45WMgQCJR0lx4KCovyy1BSlWB2SxZxLi4pS80rAQkZAgK6MKLFYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Parent ID" = _t, Active = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Parent ID", Int64.Type}, {"Active", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Parent ID"}, {{"All", each _, type table [Parent ID=nullable number, Active=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each List.Contains([All][Active],"Current")),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = false)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"}),
#"Expanded All" = Table.ExpandTableColumn(#"Removed Columns", "All", {"Active"}, {"Active"})
in
#"Expanded All"
Thanks,
But that only gives 3 rows. I was looking to get back all the rows that match the criteria
Your problem statement says - "I want the last three since there is no Active = "Current" (these have another unique parent ID)"
Hence, you are getting only 3.
In your actual data set, when you apply my method, you will get all unque parent IDs matching the criterion.
You need to replace my Source with your Source and delete changed type.
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("i45WMgQCJR0lx4KCovyy1BSlWB2SxZxLi4pS80rAQkZAgK6MKLFYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Parent ID" = _t, Active = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Parent ID", Int64.Type}, {"Active", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Parent ID"}, {{"All", each _, type table [Parent ID=nullable number, Active=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each List.Contains([All][Active],"Current")),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = false)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"}),
#"Expanded All" = Table.ExpandTableColumn(#"Removed Columns", "All", {"Active"}, {"Active"})
in
#"Expanded All"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
20 | |
10 | |
10 | |
10 |