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

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

Reply
mr_reygan
Frequent Visitor

Measure showing incorrect total

Hi,

 

I have a measure which calculates cost based on parameters. At the row level, the cost is correct. But the totals show incorrect results.

 

The expected results are:

Drinks - 13

Fruit - 5

TOTAL - 18

 

Can someone help correct my calculation please?

 

mr_reygan_0-1607037609477.png

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression that references your existing Cost measure.  Replace Table with your actual table name.

 

Cost SUMX = SUMX(VALUES(Table[Category]), [Cost])

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
v-robertq-msft
Community Support
Community Support

Hi, @mr_reygan 

According to your description, you want to get the correct total in the total row, you can try my steps:

  1. Create a measure:
Cost_new =

var _new=SUMMARIZE('Table','Table'[Category],"_value",[Cost])

return IF(HASONEVALUE('Table'[Category]),[Cost],SUMX(_new,[_value]))
  1. Go to the Matrix, replace the [Cost] with the new measure [Cost_new], like this:

v-robertq-msft_0-1607413260016.png

 

And you can get what you want.

You can create a new measure for every measure which has a wrong total value in Matrix using this method and replace them in the chart.

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@mr_reygan , Try like

sumx(Summarize(Table, Table[category], "_1",[Cost]),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , great! it worked! 🙂

Do I always have to create 2 measures? 1 for row level and another 1 for totals?

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression that references your existing Cost measure.  Replace Table with your actual table name.

 

Cost SUMX = SUMX(VALUES(Table[Category]), [Cost])

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors