Forum Discussion
Custom column of non duplicates
- Anonymous2 years ago
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 TeamIf 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
- 2 years ago
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 - 2 years ago
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 ,
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