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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

Row wise calculation

Hi Community..!!

Order No.Tot. Order Value GrossBus. Unit Code@@test
1549751713332601033260
155786541291944.461091944.46
1557893444319631031963

i have above data, @@test is my measure, i need row wise calculation, after adding total order values gross i am getting 275,833 which is wrong , addition of these values should be = 33260 + 91944 + 31963 = 157167
this is my measure 

 
@@test = 
SUMX(
            VALUES('Order Level Details'[Order No.]),
            MAX('Order Level Details'[Tot. Order Value Gross])
        )

Kindly help me on the same.

1 ACCEPTED SOLUTION
grazitti_sapna
Super User
Super User

Hi @prasadpatil020,

 

The problem is not the SUMX itself but how the row context / filters are evaluated (and sometimes duplicate rows) which makes the MAX() return unexpected values or cause double-counting.

 

Try below DAX, it creates a virtual table and then sums up the data.

@@test =
SUMX(
SUMMARIZE(
'Order Level Details',
'Order Level Details'[Order No],
"OrderVal", MAX('Order Level Details'[Tot. Order Value Gross])
),
[OrderVal]
)

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

 

View solution in original post

6 REPLIES 6
Rufyda
Memorable Member
Memorable Member

I'm glad you found a solution! We're here in the community to support each other.

Regards,
Rufyda Rahma | Microsoft MIE

Kedar_Pande
Super User
Super User

@prasadpatil020 

 

@@test = SUM('Order Level Details'[Tot. Order Value Gross])

 

Why: Simple SUM respects row context naturally and totals correctly (157167).

 

If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande

grazitti_sapna
Super User
Super User

Hi @prasadpatil020,

 

The problem is not the SUMX itself but how the row context / filters are evaluated (and sometimes duplicate rows) which makes the MAX() return unexpected values or cause double-counting.

 

Try below DAX, it creates a virtual table and then sums up the data.

@@test =
SUMX(
SUMMARIZE(
'Order Level Details',
'Order Level Details'[Order No],
"OrderVal", MAX('Order Level Details'[Tot. Order Value Gross])
),
[OrderVal]
)

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

 

Thank You so much for quick responce @grazitti_sapna 🤗

bhanu_gautam
Super User
Super User

@prasadpatil020 ,

If 'Order No.' is unique in your table, you can simply use:

@@test = SUM('Order Level Details'[Tot. Order Value Gross])

 

If there are duplicate order numbers and you want to sum only the maximum value per order, your measure is close, but you should check your data for duplicates

DAX
@@test =
SUMX(
VALUES('Order Level Details'[Order No.]),
MAX('Order Level Details'[Tot. Order Value Gross])
)

 

This will work if, for each 'Order No.', the MAX returns the correct value (which is the only value if there are no duplicates). But if your table has multiple rows per order with different 'Tot. Order Value Gross'




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

Proud to be a Super User!




LinkedIn






Thank you @bhanu_gautam 😊

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.