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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Distinct SUM of grouped values by several columns

Dear all

 
Thanks for helping me. 
This is the structure and sample of the data.
 
 
Inline image 1
 
The point is that each container could be used more than once, but TONS shouldn't be aggregate more than once for each container.
 
It's not possible to divide SUM of TONS by COUNT of IDs because there is container with Tons = 1 and Tons = 2
 
The results should be the following:
Inline image 2 Inline image 3
Thanks in advance,
Regards from Spain,
Ana Bisbé
1 ACCEPTED SOLUTION
Datatouille
Solution Sage
Solution Sage

Hi Ana, Interesting use case – you will find 2 solutions here : https://1drv.ms/u/s!Ag8khmd3N7ExgRMLmNkLKGDFmUq1

 

- DAX : I am using variables and a combination of AddColumns, Values, SumX & Context Transition

- Power Query : I am using a simple Group By in the query editor. This method is pretty simple and works if you can get rid of the « Order ID » column.

 

Tristan

View solution in original post

2 REPLIES 2
Datatouille
Solution Sage
Solution Sage

Hi Ana, Interesting use case – you will find 2 solutions here : https://1drv.ms/u/s!Ag8khmd3N7ExgRMLmNkLKGDFmUq1

 

- DAX : I am using variables and a combination of AddColumns, Values, SumX & Context Transition

- Power Query : I am using a simple Group By in the query editor. This method is pretty simple and works if you can get rid of the « Order ID » column.

 

Tristan

Anonymous
Not applicable

Thanks a lot !! It works properly.

 

Best regards and Merry Christmas !! Happy new year,

 

Regards from Spain,

 

Ana

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors