Forum Discussion
Percentage between two columns
- 5 years ago
Hello gaikwadaa123
you can join both tables by the datetime column and then expand your F-Column and then the needed calculation
Here an example
let A = let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUAyIjAyNDBQNDKwMDJR0lQ6VYHVQJI4iEkVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [DateTime = _t, #"DBDryBulb-A" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"DateTime", type datetime}, {"DBDryBulb-A", Int64.Type}}, "de-DE") in #"Changed Type", B= let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUAyIjAyNDBQNDKwMDJR0lY6VYHVQJI4iEiVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [DateTime = _t, #"DBDryBulb-F" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"DateTime", type datetime}, {"DBDryBulb-F", Int64.Type}}, "de-DE") in #"Changed Type", JoinTables= Table.NestedJoin ( A, "DateTime", B, "DateTime", "B", JoinKind.LeftOuter ), #"Expanded B" = Table.ExpandTableColumn(JoinTables, "B", {"DBDryBulb-F"}, {"DBDryBulb-F"}), #"Added Custom" = Table.AddColumn(#"Expanded B", "Custom", each ([#"DBDryBulb-A"]-[#"DBDryBulb-F"])/[#"DBDryBulb-A"]) in #"Added Custom"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy - 5 years ago
Hi gaikwadaa123 ,
After merging two tables, please detect the data type for each column, if the data type is wrong, it could cause the wrong calculation result.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I tried to append the tables and got the two columns in same table
I used the formula
But still the substarction is not looking correct. can you suggest me formula
Hi gaikwadaa123 ,
After merging two tables, please detect the data type for each column, if the data type is wrong, it could cause the wrong calculation result.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.