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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Summarize multiple variables

Hi,

 

I need to calculate the standard hours per MFG_ORDER_NAME. This calculated value per individual line is OK, but the sum is incorrect. I tried summarize function but I need help ons this.

 

For HRS_STANDARD I calculated two variables, insteltijd and produktietijd. When I add those two at the return function, the calculation at line level is correct, however the total is incorrect. I tried SUMX(SUMMARIZE but I cannot select the two calculated variables when doing so. Can anyone help with the correct syntax?

 

Import_machining_res_transactions - Power BI Desktop_2018-11-23_11-29-39.png

1 ACCEPTED SOLUTION

I would probably go with something like:

 

Measure Total =
VAR __table = SUMMARIZE('Table',[MFG_ORDER_NAME],[DEPARTMENT],[BASIS],"__hrsStandard",[HRS STANDARD])
VAR __total = SUMX(__table,[__hrsStandard])
RETURN
IF(HASONEVALUE([DEPARTMENT]),[HRS STANDARD],__total)

You may have to modify the SUMMARIZE.



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

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

 

Write this additional measure and drag this to the Table visual

 

=IF(HASONEVALUE(MFG_ORDER_NAME),[HRS_STANDARD],SUMX(SUMMARIZE(VALUES([MFG_ORDER_NAME]),[MFG_ORDER_NAME],"ABCD",[HRS_STANDARD]),[ABCD]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish,

 

Tried following extra measure and dragged it into the visual. Still total is incorrect

 

Import_machining_res_transactions - Power BI Desktop_2018-11-30_11-24-15.png

Hi,

 

Share the link from where i can download your PBI file.  Also, show the expected result in a tet box there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Anonymous
Not applicable

Greg,

 

Your solution summarizes also 4.5 hours instead of 32.85 (See measure total).

 

For the PBix file see: https://drive.google.com/open?id=13X8wROZ0tyUlwI3uahNAZK_Y0u7EtVSy

 

Import_machining_res_transactions - Power BI Desktop_2018-11-30_16-12-19.png

Anonymous
Not applicable

Hi Ashish,

 

Hereby the link and expected result. I rebuild the Power BI file to a document based on excel. The original file is a file based on direct query on our data warehouse which I cannot share with underlying data.

 

This is the link: https://drive.google.com/open?id=13X8wROZ0tyUlwI3uahNAZK_Y0u7EtVSy

Greg_Deckler
Community Champion
Community Champion

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



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...
Anonymous
Not applicable

Thanks for your reply. I read your articles. Can you show how my calculation should look like?

I would probably go with something like:

 

Measure Total =
VAR __table = SUMMARIZE('Table',[MFG_ORDER_NAME],[DEPARTMENT],[BASIS],"__hrsStandard",[HRS STANDARD])
VAR __total = SUMX(__table,[__hrsStandard])
RETURN
IF(HASONEVALUE([DEPARTMENT]),[HRS STANDARD],__total)

You may have to modify the SUMMARIZE.



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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.