The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi Team,
I have a data as below. I need help on removing the Duplicate row where the Status is I and the 'Loc" is International.
the catch here is there can be employees with same status and Loc but they will have only one row. I only need to remove employees who have a duplicate record with this condition.
In this below data I need to remove only 1002 and 1006 duplicate record and not the 1004. Any idea on acheiving this please..?
emp no | status | Loc |
1001 | A | State |
1002 | I | State |
1002 | I | International |
1004 | I | International |
1005 | A | State |
1006 | I | State |
1006 | I | International |
1008 | I | State |
Solved! Go to Solution.
let
Source = the first step/s that brings your table to Power Query
#"Added Conditional Column" = Table.AddColumn(#"Source", "Sorting", each if [Loc] = "International" then 1 else 0),
#"Sorted Rows" = Table.Sort(#"Added Conditional Column",{{"Sorting", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows", {"emp no"}),
#"Sorted Rows1" = Table.Sort(#"Removed Duplicates",{{"emp no", Order.Ascending}}),
#"Removed Columns" = Table.RemoveColumns(#"Sorted Rows1",{"Sorting"})
in
#"Removed Columns"
let
Source = the first step/s that brings your table to Power Query
#"Added Conditional Column" = Table.AddColumn(#"Source", "Sorting", each if [Loc] = "International" then 1 else 0),
#"Sorted Rows" = Table.Sort(#"Added Conditional Column",{{"Sorting", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows", {"emp no"}),
#"Sorted Rows1" = Table.Sort(#"Removed Duplicates",{{"emp no", Order.Ascending}}),
#"Removed Columns" = Table.RemoveColumns(#"Sorted Rows1",{"Sorting"})
in
#"Removed Columns"
@LP280388 in case of duplicated it will always be I on status on all the duplicates or can also be different combinations (AA / AI )?
In PowerQuery
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
119 | |
86 | |
75 | |
55 | |
44 |
User | Count |
---|---|
136 | |
128 | |
78 | |
64 | |
63 |