I have a spreadsheet that contains the change history of various documents.
It may happen that the title or the name of the document changes. However, the document number remains the same.
I'm looking for a way (in power query) to mark or see the documents where the name or title has changed.
The table has the following structure:
Row | Document number | Title | Name | Date of change |
1 | 000.001 | Abc | Xyz | 01.01.2020 |
2 | 000.001 | Abcd | Xyz | 02.01.2020 |
3 | 000.002 | Abc | Xyz | 03.01.2021 |
4 | 000.002 | Abc | Wxyz | 02.01.2021 |
5 | 000.003 | Abc | Xyz | 02.02.2022 |
6 | 000.003 | Abc | Xyz | 02.03.2022 |
Same code, just a different source. Maybe use Table.Buffer but it may not bring much.
Hi Ibendlin,
Okay. What would the code look like if I wanted to use it for another dataset with an extremely large number of rows?
Thank you for your help.
I'm curious. What does the long string of numbers at the beginning of the code mean or do? i45WM...
This can be done in a variety of ways. Here's one.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIwMNAzMACxHJOSgWREZRVI1FAPiIwMjAyUYnWilYzQFaYgVBqhqDSGqzRCN9IYqtAQrNAEi8LwClQjISpN4SqN0Y0EKjQCKTQCKzTDq9AYqjAWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Row = _t, #"Document number" = _t, Title = _t, Name = _t, #"Date of change" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Row", Int64.Type}, {"Document number", type text}, {"Title", type text}, {"Name", type text}, {"Date of change", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Document number"}, {{"Min Title", each List.Min([Title]), type nullable text}, {"Max Title", each List.Max([Title]), type nullable text}, {"Min Name", each List.Min([Name]), type nullable text}, {"Max Name", each List.Max([Name]), type nullable text}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Changed", each [Min Title]<>[Max Title] or [Min Name]<>[Max Name]),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Document number", "Changed"})
in
#"Removed Other Columns"
mmbr1606
9
Super User 2025 Season 1
stampcoin
7
SD-13050734-0
6