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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

DAX Group by Calculation

Hello,

 

Please can someone help me with my calculation.

 

I have a dataset which looks like the below, I cannot change the structure of the data. I need to create a calculation which will multiply the 'UnitOfMeasure' (Recycled and Reused) against the associated Unit Weight for that 'AssetType'. e.g. Laptops Recycled (1438) * Laptops Unit Weight (2) = 2876

 

AssetTypevolumeUnitOfMeasure
Laptops1438Recycled
Laptops16676Reused
Laptops2Unit Weight
Monitors450Recycled
Monitors9571Reused
Monitors8Unit Weight
Printers0Recycled
Printers11Reused
Printers20Unit Weight
Server25Recycled
Server26Reused
Server12Unit Weight

 

I need to calculate the total for Recycled and Reused, in the example provided I should be returned with the total below of 6,776 Recycled and 110,320 Reused. 

 

AssetTypeRecycledReused
Laptops         2,876           33,352
Monitors         3,600           76,568
Printers0                   88
Server            300                 312
Total         6,776         110,320
1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Anonymous 
Try this 2 formulas:

1.

recycled =
sumx(
    SUMMARIZE('Table','Table'[AssetType],"total rec",CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Recycled")*CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Unit Weight")),[total rec])
2.
reused =
sumx(
    SUMMARIZE('Table','Table'[AssetType],"total reu",CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Reused")*CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Unit Weight")),[total reu])
Ritaf1983_0-1701708329702.png

the pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

It works, thank you for your help! 🙂

Ritaf1983
Super User
Super User

Hi @Anonymous 
Try this 2 formulas:

1.

recycled =
sumx(
    SUMMARIZE('Table','Table'[AssetType],"total rec",CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Recycled")*CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Unit Weight")),[total rec])
2.
reused =
sumx(
    SUMMARIZE('Table','Table'[AssetType],"total reu",CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Reused")*CALCULATE(sum('Table'[volume]),'Table'[UnitOfMeasure]="Unit Weight")),[total reu])
Ritaf1983_0-1701708329702.png

the pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.