Forum Discussion
DAX Help - Compute Correct Total
- 3 years ago
Hi Anonymous
Create a measure with the following DAX Code:Total = sumx( 'Table', 'Table'[Rate]*'Table'[Amount])
_____________________________________________
Alternatively,
1. Create a custom column"Total" in Power Query Editor = [Rate]*[Amount]2. In the report view, create a measure Total = Sum([Total])
Power Query code for calculated column:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnZU0lEy0DMFkoYGQKAUqxOtFOwGFzQFi8UCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [State = _t, Rate = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Rate", type number}, {"Amount", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Total", each [Rate]*[Amount]),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Total", type number}})
in
#"Changed Type1"
Please accept this as the solution if it resolves your query.
Appreciate a thumbs up if it helps.
Hi Anonymous
Create a measure with the following DAX Code:
_____________________________________________
Alternatively,
1. Create a custom column"Total" in Power Query Editor = [Rate]*[Amount]
2. In the report view, create a measure Total = Sum([Total])
Power Query code for calculated column:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnZU0lEy0DMFkoYGQKAUqxOtFOwGFzQFi8UCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [State = _t, Rate = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Rate", type number}, {"Amount", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Total", each [Rate]*[Amount]),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Total", type number}})
in
#"Changed Type1"
Please accept this as the solution if it resolves your query.
Appreciate a thumbs up if it helps.