Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Say I have a column of ID values in Power BI with many duplicates for each ID value. If I wanted to make a custom column where each ID only appears once and duplicates will have Blank() value. How would I code that?
Solved! Go to Solution.
Hi @nathan_kul ,
Please refer to the following steps. You can adjust the Source step to match your actual data source.
let
Source = Table.FromRecords({[ID = 1], [ID = 2], [ID = 2], [ID = 3], [ID = 3], [ID = 3]}),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Data", each Table.AddIndexColumn(_, "Index", 0, 1, Int64.Type)}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Index"}, {"Index"}),
#"Added Custom" = Table.AddColumn(#"Expanded Data", "ID2", each if [Index]=0 then [ID] else null),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @nathan_kul, different approach here:
I've used @Anonymous sample data.
Output
let
Source = Table.FromRecords({[ID = 1], [ID = 2], [ID = 2], [ID = 3], [ID = 3], [ID = 3]}),
GroupedRows = Table.Group(Source, {"ID"}, {{"All", each Table.FromColumns(Table.ToColumns(_) & {{[ID]{0}?}}, Value.Type(_ & #table(type table[Unique ID=Int64.Type],{}))), type table}}),
Combined = Table.Combine(GroupedRows[All])
in
Combined
lovely question, use this formula to reach this result
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if List.Contains(List.FirstN(Source[ID],[Index]),[ID]) then "" else [ID])
in
#"Added Custom"
lovely question, use this formula to reach this result
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if List.Contains(List.FirstN(Source[ID],[Index]),[ID]) then "" else [ID])
in
#"Added Custom"
Hi @nathan_kul, different approach here:
I've used @Anonymous sample data.
Output
let
Source = Table.FromRecords({[ID = 1], [ID = 2], [ID = 2], [ID = 3], [ID = 3], [ID = 3]}),
GroupedRows = Table.Group(Source, {"ID"}, {{"All", each Table.FromColumns(Table.ToColumns(_) & {{[ID]{0}?}}, Value.Type(_ & #table(type table[Unique ID=Int64.Type],{}))), type table}}),
Combined = Table.Combine(GroupedRows[All])
in
Combined
Hi @nathan_kul ,
Please refer to the following steps. You can adjust the Source step to match your actual data source.
let
Source = Table.FromRecords({[ID = 1], [ID = 2], [ID = 2], [ID = 3], [ID = 3], [ID = 3]}),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Data", each Table.AddIndexColumn(_, "Index", 0, 1, Int64.Type)}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Index"}, {"Index"}),
#"Added Custom" = Table.AddColumn(#"Expanded Data", "ID2", each if [Index]=0 then [ID] else null),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum