Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Dan_K_Howe99
Regular Visitor

DAX Help - Compute Correct Total

Total = Rate * Amount

 

Dan_K_Howe99_0-1672173747295.png

 

I need a DAX expression that will return the correct total for both CA & FL (5,000 + 2,500 = 7,500)

 

Current expression is returning 15,000

 

Dan_K_Howe99_1-1672173782985.png

 

Below returns 15,000

VAR _RATE = SUMX( VALUES('table'[State]), SUM('Table'[Rate]))
VAR _TOTAL = [Amount] * _RATE

 

Essentially, need an expression that will sum the Total column in first table.

 

Thank you

1 ACCEPTED SOLUTION
adudani
Super User
Super User

Hi @Dan_K_Howe99 

Create a measure with the following DAX Code:

Total = sumx( 'Table', 'Table'[Rate]*'Table'[Amount])



adudani_0-1672174763950.png

_____________________________________________
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.

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Dan_K_Howe99 In addition to @adudani see if this information is helpful as well:

First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
adudani
Super User
Super User

Hi @Dan_K_Howe99 

Create a measure with the following DAX Code:

Total = sumx( 'Table', 'Table'[Rate]*'Table'[Amount])



adudani_0-1672174763950.png

_____________________________________________
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.

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.