Forum Discussion
Power Query: Extract distinct values from column as new query
- Anonymous9 years ago
Hi Anonymous,
You can try to create a blank query to reference original source, then use list.distinct to remove duplicate records.
let DistinctSource = List.Distinct(Sheet2[Date])// List.Distinct(QueryName[ColumnName]) in DistinctSourceSheet2(22582 rows) -> Date(953 rows)
Regards,
Xiaoxin Sheng
In the Power Query editor:
Right click on your existing query and choose "Reference".
Use "Choose Columns" to select only the column which you want your unique values generated from.
Right click on the column and choose "Remove Duplicates"
- Power_BI_Guy6 years agoNew Member
This is the users current solution, however this is inefficient as it loads the entire table and then performs the transformations.
Current best solution is:
let DistinctSource = List.Distinct(Sheet2[Date])// List.Distinct(QueryName[ColumnName]) in DistinctSource- alfranco176 years agoAdvocate I
Thanks! This is just the alternative I was looking for.
- crazymaca694 years agoNew Member
Your code is slightly wrong. I've edited it below 🙂
let DistinctSource = List.Distinct(Sheet2,"Date")// List.Distinct(QueryName,"ColumnName") in DistinctSource
- Stephen_Sink3 years agoFrequent Visitor
I like this solution because it allows you to continue to use table tools and create new custom column off the de-duplicated list. Power BI Guy's solution may be more effecient however.