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! Request now

Reply
Anonymous
Not applicable

Calculating sum of paired items On the same Column

Hello Team,

 

I'm really struggling on how to do this in Power BI. Although Excel sheet is workable but I was hoping that I can do this in Power BI to have this automated.

 

Background, I have an Item ledger Entries table in our Business Central that I can get the data from. The products under the Item No is paired with each other. So we have Filled Cannisters that are sold, in turn customers return these cannisters and tagged as Empty Cannisters - each have their own quantity. I have 17 types of cannisters so that means that I have 34 Item numbers to work on. 🙂 

 

So what I aim to do is create a report that looks like this:

 

Posting Month <-> Filled Cannister Item No <-> Empty Cannister Item No <-> Sum Quantity of Filled Cannister <-> Sum Quantity of Empty Cannister <-> Delta  

 

The Delta will give m an idea how many cannisters are being returned to us. 🙂

 

Hope you can help me on this. 

 

Thank you in advance,

 

BR,

Abe

5 REPLIES 5
Anonymous
Not applicable

Are these items at the date level in your source, or at the month level? It sounds like you could just add a Date.MonthName  column in your items table, using your date column as a parameter. Then group on month name and Item Number. Then, you can add your 

sum aggregations. Then you can do your row arithmetic. 

 

--Nate

Greg_Deckler
Community Champion
Community Champion

@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



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

Hello @Greg_Deckler ,

 

Sorry for that. Here is an example:

 

Raw table from Business Central Dynamics 365 looks like this:

 

Posting Date Entry Type Document Type Item No. Location Code Quantity

2/17/2022SaleSales ShipmentFILLCAN01WEST-10
2/17/2022SaleReturn ReceiptEMPCAN01WEST10
2/17/2022SaleSales ShipmentFILLCAN02EAST-10
2/17/2022SaleSales ShipmentFILLCAN03WEST-20
2/16/2022SaleReturn ReceiptEMPCAN02EAST30
2/16/2022SaleSales ShipmentFILLCAN01EAST-20
2/15/2022SaleReturn ReceiptEMPCAN03WEST

5

 

So as we can see, pair here is FILLCAN01-EMPCAN01, FILLCAN02-EMPCAN02... FILLCANXX-EMPCANXX. 

Inventory going out is negative (Sales Shipment). Returned Inventory is positive (Return Receipt). 

 

My final report/table may look like this:

 

Location Code Item No. Product Sold Product Returned Sum

WESTFILLCAN01-10100
WESTFILLCAN02000
WESTFILLCAN03-205-15
EASTFILLCAN01-200-20
EASTFILLCAN02-103020
EASTFILLCAN03000

 

Per above, the only one in the column is the FILLCANXX. Only the value of the FILLCANXX and the EMPCANXX is noted and I need to sum both Product Sold and Product Received to get the Delta (i.e., negative indicating customer returned more cannisters and positive indicating customer still owe us to return the cannisters). 

 

Hope this helps in describing my dilemma. 🙂 


Thanks in advance.

 

BR,

Abe

@Anonymous So maybe:

Product Sold = SUMX(FILTER('Table',[Entry Type] = "Sales"),[Quantity])

Product Returned = SUMX(FILTER('Table',[Entry Type] = "Return"),[Quantity])

Sum = SUM('Table'[Quantity])


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 @Greg_Deckler ,

 

When I tried this out on PowerBI, I got the following result:

 

Location Code Item No. Product Sold Product Returned Sum

EASTFILLCAN01-20--20
EASTFILLCAN02---
EASTFILLCAN03-20--20
EASTEMPCAN01---
EASTEMPCAN02-3030
EASTEMPCAN03---
WESTFILLCAN01-10--10
WESTFILLCAN02-10--10
WESTFILLCAN03---
WESTEMPCAN01-1010
WESTEMPCAN02---
WESTEMPCAN03---

 

Unfortunately this is not what I was expecting to achieve. The key requirement here is to pair up the data between two joining items, let's say, FILLCAN01 and EMPCAN01 and sum it up resutling to the Delta that I was looking for.

 

Then the table will only display the Filled Cannister item numbers, the ordered quantity (FILLCANXX quantity), the quantity returned (EMPCANXX quantity) and the resulting Delta all in one row. 🙂 

 

Quite a feat to wrap my head around it to be honest. 🙂 

 

Thanks for spending time on this. Really appreciated. 

 

BR,

Abe

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.