Forum Discussion
Tjordaske85
3 years agoFrequent Visitor
How to remove old revisions
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 ...
- 3 years ago
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 _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yanjiang-msft
3 years agoCommunity Support
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.