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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.