- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Help SUM by Two columns: Origin and Destination
Hello there!
I am having some trouble with something that I believe should be more o less easy, but my DAX is still very basic, so I would love if you could help me!
Among other tables, I have two tables that are connected via RECIPIENT -> USER:
Table 1: DATE || ORIGIN || RECIPIENT || QUANTITY
Table 2: User
Table 1 is basically listing a number os ocassions where a user gave some office material to another user, by date and quantity.
I am trying to generate a measure with the summary of items each user has, that should be:
- Adding up all the quantity received (Column Quantity) when the user is a recipient and;
- Substracting the quantity sent (again, Quantity Column) when the user is the Origin.
The result Table I am trying to generate will be basically USER and the above mentioned measure.
Any ideas on how to define this measure?
Thanks a lot!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Rate,
might not be the most elegant solution but have a look at this:
I made two tables with SUMMARIZE in order to group the quantity by origin and destination:
Origin = SUMMARIZE(movimientos_supervisores_azafat,movimientos_supervisores_azafat[Origin],"Origin Quantity",SUM(movimientos_supervisores_azafat[Quantity]))
Recepients = SUMMARIZE(movimientos_supervisores_azafat,movimientos_supervisores_azafat[Destination],"Rec Quantity",SUM(movimientos_supervisores_azafat[Quantity]))
Then I connected the these two tables with your User table via User and Origin/Destination
Finally I made this measure with the substraction:
Quantity by User = SUM(Recepients[Rec Quantity])-SUM(Origin[Origin Quantity])
please let me know if it helped you.
Regards,
Barna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Rate,
might not be the most elegant solution but have a look at this:
I made two tables with SUMMARIZE in order to group the quantity by origin and destination:
Origin = SUMMARIZE(movimientos_supervisores_azafat,movimientos_supervisores_azafat[Origin],"Origin Quantity",SUM(movimientos_supervisores_azafat[Quantity]))
Recepients = SUMMARIZE(movimientos_supervisores_azafat,movimientos_supervisores_azafat[Destination],"Rec Quantity",SUM(movimientos_supervisores_azafat[Quantity]))
Then I connected the these two tables with your User table via User and Origin/Destination
Finally I made this measure with the substraction:
Quantity by User = SUM(Recepients[Rec Quantity])-SUM(Origin[Origin Quantity])
please let me know if it helped you.
Regards,
Barna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Barnee
Thank you for the quick response. I have tried your solution, and it seems to work halfway, mostly for my careless explanation in the request. I am also in need of knowing the amount of the specific product (by code or despcription) that is being given by each origin.
Any ideas on how to include this into your solution?
Thanks a lot!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again,
I started playing around with your solution and just added a new column for the Code and that made it.
Origin = SUMMARIZE(movimientos_supervisores_azafat,movimientos_supervisores_azafat[Origin],movimientos_supervisores_azafat[Codigo],"Origin Quantity",SUM(movimientos_supervisores_azafat[Quantity]))
Thanks a lot for your help!! As usual, better done than perfect!
Really grafetul @Barnee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Rate Any sample data will be really helpful
Did I answer your question? Mark my post as a solution!
Proud to be a PBI Community Champion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again,
Of course, I have uploaded an example to Wetransfer. Please, let me know if you need any further clarification.
Thanks dearly!

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
09-11-2024 01:20 PM | |||
05-01-2024 01:55 PM | |||
08-26-2024 02:49 AM | |||
09-06-2024 01:56 AM | |||
07-08-2024 10:48 AM |