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.
Hi,
I'm having this table:
As you can see a document with a certain name (column 'Naam') is several times in the table and has sometimes several revisions (column 'Revisie).
I want to keep only ALL rows with the latest revisions (which is sometimes 0, but can also be a 1, 2, 3, ...).
So all the rows in the green frames needs to remain, all other rows needs to be hided or deleted.
Any ideas or suggestions?
Solved! Go to Solution.
Hi @Tjordaske85 ,
According to your description, here's my solution.
1.Add a custom column.
Table.SelectRows(#"Changed Type",(x)=>x[Map]=[Map] and x[Naam]=[Naam])[Revisie]{0}
2.Add a step in Advanced editor.
#"Filter"=Table.SelectRows(#"Added Custom",each [Revisie]=[Custom])
Result:
Here's the whole M syntax:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7ZKxCsIwEIZf5chcYi50cpU6OtiKQulw2qsEai8kseLbW30FQVE63D/8w/fBz9W1ymHn0igc3HCOrcToOCyhOFTFdrPINeocShpcIhdUpkqDBNEL94k67rVvu6m1qslm0idJ+Nck81VStTaWwKA2Vj8ToUxEQwunXiInuEwn/ijX20sXOHIYxQVId8+wXyG+Mcgs/2359HDNAw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Map = _t, Naam = _t, Revisie = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Map", type text}, {"Naam", type text}, {"Revisie", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.SelectRows(#"Changed Type",(x)=>x[Map]=[Map] and x[Naam]=[Naam])[Revisie]{0}),
#"Filter"=Table.SelectRows(#"Added Custom",each [Revisie]=[Custom]),
#"Removed Columns" = Table.RemoveColumns(Filter,{"Custom"})
in
#"Removed Columns"
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Tjordaske85 ,
According to your description, here's my solution.
1.Add a custom column.
Table.SelectRows(#"Changed Type",(x)=>x[Map]=[Map] and x[Naam]=[Naam])[Revisie]{0}
2.Add a step in Advanced editor.
#"Filter"=Table.SelectRows(#"Added Custom",each [Revisie]=[Custom])
Result:
Here's the whole M syntax:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7ZKxCsIwEIZf5chcYi50cpU6OtiKQulw2qsEai8kseLbW30FQVE63D/8w/fBz9W1ymHn0igc3HCOrcToOCyhOFTFdrPINeocShpcIhdUpkqDBNEL94k67rVvu6m1qslm0idJ+Nck81VStTaWwKA2Vj8ToUxEQwunXiInuEwn/ijX20sXOHIYxQVId8+wXyG+Mcgs/2359HDNAw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Map = _t, Naam = _t, Revisie = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Map", type text}, {"Naam", type text}, {"Revisie", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.SelectRows(#"Changed Type",(x)=>x[Map]=[Map] and x[Naam]=[Naam])[Revisie]{0}),
#"Filter"=Table.SelectRows(#"Added Custom",each [Revisie]=[Custom]),
#"Removed Columns" = Table.RemoveColumns(Filter,{"Custom"})
in
#"Removed Columns"
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Tjordaske85 ,
you should sort your table by "Revisie" in descending order and buffer that step:
https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-i...
Then check the first 2 columns and remove duplicates.
That will keep only the latest from them.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
8 | |
7 | |
6 | |
6 |