Forum Discussion
Anonymous
3 years agoNot applicable
Checking if a Column Changed from Last Month to This Month
Good day,
I am trying to see if there is a function that I can use to track if the record of same account number had changed over time. I am looking if I can add an extra column and if there is a change says "Yes" and if there is non says "No". the record of the time has more months, but I had filter the months into the first two months.
Below is an example of my matrix table.
| Account Number | The End of Last Month | Today |
| 1 | Increase | Increase |
| 2 | Decrease | |
| 3 | Non Change | Non Change |
*There is a possibility of blank if the account is close.
Appreciate for any help.
Here is one way
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLMSy5KTSxOxclUitWJVjICMlxS4WKJSckgGaikMZDhl5+n4JyRmJeeis4Bq4oFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Account Number" = _t, #"The End of Last Month" = _t, Today = _t, ColA = _t, ColB = _t]), #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Account Number", "The End of Last Month", "Today", "ColA", "ColB"}), #"Added Custom" = Table.AddColumn(#"Replaced Value", "Change", each [a = List.RemoveNulls(List.Skip(Record.ToList(_))), b = if List.MatchesAll(a, each _=a{0}) then "Yes" else "No"][b]) in #"Added Custom"
1 Reply
- Vijay_A_Verma
Most Valuable Professional
Here is one way
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLMSy5KTSxOxclUitWJVjICMlxS4WKJSckgGaikMZDhl5+n4JyRmJeeis4Bq4oFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Account Number" = _t, #"The End of Last Month" = _t, Today = _t, ColA = _t, ColB = _t]), #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Account Number", "The End of Last Month", "Today", "ColA", "ColB"}), #"Added Custom" = Table.AddColumn(#"Replaced Value", "Change", each [a = List.RemoveNulls(List.Skip(Record.ToList(_))), b = if List.MatchesAll(a, each _=a{0}) then "Yes" else "No"][b]) in #"Added Custom"