Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
acerNZ
Helper III
Helper III

Question on removing duplicates, via GUI and using Distinct formula

Experts 

I am trying to remove unique column elements and bit lost on seemingly simple things. help ?

1. GUI stuff: In the query editor, where do you find, remove duplicates in columns, I see this only on right click "Remove Duplicates" where can I find "Remove Duplicates" in the GUI, I could not find in the Query Editor's File, Home, Transform or Add Columns..

Are there some functionality only provided in Right click ?

2. Determined to get this, I added "Custom Column" and tried 2 different ways table.distinct and list.distinct and used the source input column listed (inserted), I get error in both ways saying 

 

Expression.Error: We cannot apply field access to the type Function.
Details:
Value=[Function]
Key=Data Key

 

what mistake, I am doing here? my colummn name is "Data key" and formula is Table.Distinct([Data Key]), tried with/without brackets "()" and the same for list.Distinct .. 

 

3. How to remove selected Rows in random places ? 2020-10-11_10h02_57.png2020-10-10_20h48_05.png

2 ACCEPTED SOLUTIONS
Jimmy801
Community Champion
Community Champion

Hello @acerNZ 

 

you cannot copy paste my code into yours. You can create a new blank query and paste it there to see all steps how it's working. You can either go to your query and use the GUI for create a distinct table (as shown in my screenshot) or to analyse my code and try to change your code accordingly (for sure not easy task if never done, but you can make it).

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

v-yingjl
Community Support
Community Support

Hi @acerNZ ,

1. Besides right click the column to use remove duplicates, you can also find it in the Home ribbon:

remove rows.png

2. Table.distinct() is used for a table, List.distinct() is used for a list, you cannot use them to add a custom column in power query. Refer the corresponding documents about them with samples in the docuements.

3. I could think remove selected Rows in random places as select random rows, you can refer this article which introduces it in details that could help you: How to get a random sample of data with Power Query 

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-yingjl
Community Support
Community Support

Hi @acerNZ ,

1. Besides right click the column to use remove duplicates, you can also find it in the Home ribbon:

remove rows.png

2. Table.distinct() is used for a table, List.distinct() is used for a list, you cannot use them to add a custom column in power query. Refer the corresponding documents about them with samples in the docuements.

3. I could think remove selected Rows in random places as select random rows, you can refer this article which introduces it in details that could help you: How to get a random sample of data with Power Query 

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot Yingjie Li

Oh cannot I have 2 replies as solution? You removal of rows is a solution, which I should try thank you. 

Jimmy801
Community Champion
Community Champion

Hello @acerNZ 

 

check out this code. I applied 2 different type of distinct (table and list)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sgsSlVISSxJVYrViVZyT81LSS0CM138ncB0QEZ+XqohgmkEZtJRWywA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Data Key" = _t]),
    ChangeType = Table.TransformColumnTypes(Source,{{"Data Key", type text}}),
    AddedDistinctedTableInColumn = Table.AddColumn(ChangeType, "Custom", each Table.Distinct(ChangeType,"Data Key")),
    AddedDistictedListInColumn = Table.AddColumn(AddedDistinctedTableInColumn, "Custom.1", each List.Distinct(ChangeType[Data Key])),
    CreateDistinctTableSpecifiyingColumn = Table.Distinct(ChangeType, "Data Key")
    
in
    CreateDistinctTableSpecifiyingColumn

 

the distinct-function you can find left-click on the table

Jimmy801_0-1602483698993.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

@Jimmy801 Thanks a ton Jimmy

Please can you help me, I do not see new blank query for advanced editor, did you mean erase the existing code? 

2. I appended your code to the existing one and editor did not like, it expected eof ..2020-10-12_23h33_03.png

 

2020-10-12_23h42_39.png

Jimmy801
Community Champion
Community Champion

Hello @acerNZ 

 

you cannot copy paste my code into yours. You can create a new blank query and paste it there to see all steps how it's working. You can either go to your query and use the GUI for create a distinct table (as shown in my screenshot) or to analyse my code and try to change your code accordingly (for sure not easy task if never done, but you can make it).

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

MattAllington
Community Champion
Community Champion

The menu item is hidden under (I think) Transform, Reduce Rows, or Remove rows, or something like that. I think it is the home menu

 

adding a column will never help. These functions you mention generate new tables and lists. That is not what you need. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Thank you @MattAllington 

Really this is putting me off track. Not finding menu is one thing but keen to know the why distinct formula is not working and where to use list and table. Any help would be appreciated.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.