Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I have a list of data with 2 nested tables with before and after process data. How do I write the code to find the delta between the before and after table? row 1 and column 1 of [after] table subtract row 1 and column 1 of [before] table respectively for the rest of the data.
| ID | before | after |
| 1 | Table | Table |
| 2 | Table | Table |
| 3 | Table | Table |
| 4 | Table | Table |
The data in the nested table is like this
Before:
| 0.0522 | 0.0476 | 0.0439 | 0.0424 |
| 0.0356 | 0.0316 | 0.0286 | 0.0264 |
| 0.0221 | 0.0191 | 0.0162 | 0.0136 |
| 0.01 | 0.0079 | 0.0054 | 0.0033 |
| -0.0008 | -0.0011 | -0.003 | -0.0051 |
After:
| -0.098 | -0.0696 | -0.0004 | 0.0482 |
| -0.071 | -0.0065 | 0.032 | 0.0284 |
| -0.0023 | 0.0323 | 0.02 | 0.0004 |
| 0.036 | 0.023 | -0.0012 | -0.0203 |
| 0.0258 | 0.0013 | -0.0191 | -0.037 |
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSRCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "before", each Before),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "after", each After),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Column1", each [after]{[ID]-1}[Column1]-[before]{[ID]-1}[Column1]),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Column2", each [after]{[ID]-1}[Column2]-[before]{[ID]-1}[Column2]),
#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Column3", each [after]{[ID]-1}[Column3]-[before]{[ID]-1}[Column3]),
#"Added Custom5" = Table.AddColumn(#"Added Custom4", "Column4", each [after]{[ID]-1}[Column4]-[before]{[ID]-1}[Column4])
in
#"Added Custom5"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSRCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "before", each Before),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "after", each After),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Column1", each [after]{[ID]-1}[Column1]-[before]{[ID]-1}[Column1]),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Column2", each [after]{[ID]-1}[Column2]-[before]{[ID]-1}[Column2]),
#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Column3", each [after]{[ID]-1}[Column3]-[before]{[ID]-1}[Column3]),
#"Added Custom5" = Table.AddColumn(#"Added Custom4", "Column4", each [after]{[ID]-1}[Column4]-[before]{[ID]-1}[Column4])
in
#"Added Custom5"
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |