Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello
I speak about power queries on desktop power bi.
Here is my table records
[Field1 = "A", Field2 = "1", Field3= 20231201],
[Field1 = "A", Field2 = "1", Field3= 20240101],
[Field1 = "B", Field2 = "2", Field3= 20231201]
Is it possible to supress duplicates records on Field1 and Field2 with a condition on Field 3 asking for example to keep the newer date?
The result should be;
[Field1 = "A", Field2 = "1", Field3= 20240101],
[Field1 = "B", Field2 = "2", Field3= 20231201]
Is it possible with Table.Distinct or a kind of Power query like that?
Thanks!
Solved! Go to Solution.
Hi
I Found by myself.
The solutions proposed with grouping and expanding rows can't suppress duplicates fields.
We have to
It works fine!
🙂
Can somebody help please?
Hi
I Found by myself.
The solutions proposed with grouping and expanding rows can't suppress duplicates fields.
We have to
It works fine!
🙂
And please don't forget I'm using Power BI Desktop not excel.
I have readen carrefully and did exactly this=>
= Table.Group(#"Colonnes renommées4", {"COLLABORATEURId", "CODE PROJETId"}, {{"COUPLE COLLAB PROJET", each List.Max([DATE FIN]), type datetime}})
And it works for Grouping.
But after there is nothing to expand by clicking on icons at top of column of [COUPLE COLLAB PROJET].
If I try to write directly this =>
#"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", {"Field2", "Field3"}, {"Field2", "Field3"})
Do I have to put the name of all my 7 columns this way=>
#"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", {"Field2", "Field3","Field4","Field5","Field6","Field7" }, {"Field2", "Field3","Field4","Field5","Field6","Field7" })
?
Thanks.
You obviously have not see my solution carefully at all. Where have i used List.Max???? I have used Table.Max. Also, there is no type datetime in the Table.Group step of my solution. Please study my solution carefully.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Field1", type text}, {"Field2", Int64.Type}, {"Field3", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Field1"}, {{"All", each Table.Max(_,"Field3")}}),
#"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", {"Field2", "Field3"}, {"Field2", "Field3"})
in
#"Expanded All"
Hope this helps.
Hi Ashish
Thank you for you help. I succeeded to group. But It did not succeed on expanding all the other fields.
I got this when grouping.
How can i manage the Table.ExpandRecordColum so as to get back all the other fields?
Thanks.
You are welcome. You just have to click on the icon in the header and select the fields that you want to expand.
Hi Ashish
There is nothing to expand when i click these ways, have a look =>
I cannot help you by looking at screenshots. Read my solution carefully again and retry.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
26 |
User | Count |
---|---|
94 | |
50 | |
43 | |
40 | |
35 |