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

Allocate quantity based on match in another column

Hello community!

 

I have the following problem when trying to calculate a total quantity. I have a table containing a list of article codes that represent tyres or wheelsets. All have a forecasted quantity. The wheelsets consist of both a tyre and a tube. Thus, to calculate the total forecasted quantity of a tyre I need to take into account the corresponding wheelset quantities as well. Important to note is that there are tyres that exists in multiple wheelset combinations.

 

The aim is to sum the forecasted tyre quantity plus the wheelset quantity that contains the tyre to come to a total forecasted quantity per article code. See an example below as well.

 

 

Table 1   
Article CodeQuantityContains Tyre
Tyre 1100 
Tyre 2130 
Tyre 3200 
Wheel 150Tyre 1
Wheel 230Tyre 3
Wheel 340Tyre 2
Wheel 440Tyre 1
Wheel 560Tyre 2

 

 

Desired Result   
Article CodeQuantityContains TyreTotal Quantity
Tyre 1100 190
Tyre 2130 230
Tyre 3200 230
Wheel 150Tyre 150
Wheel 230Tyre 330
Wheel 340Tyre 240
Wheel 440Tyre 140
Wheel 560Tyre 260

 

I hope my request is clear and thanks in advance for any help! 

 

Greetings,

 

Tim

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a new column

new column =
var _t1 = [Article Code]
return
[Quantity] + sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Create a new column

new column =
var _t1 = [Article Code]
return
[Quantity] + sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello Amitchandak,

 

I use above solution in a calculation per month. However, the combinations of tyre and wheel can differ per month (sometimes we only have one combination sometimes two) and the formula seems to only sum those months where all combinations are present. The months in which only one tyre and wheel combination is present are not summed.

 

Do you a solution for this issue?

 

Thanks!

Anonymous
Not applicable

Wauw thank you so much that worked perfectly and a very quick response! One more question though is that I need this to be also filtered per date. How can I insert that into this formula?

 

Thanks a lot!

Anonymous
Not applicable

Hello community, I have found that the solution to my question above was a calculate and allexcept combination. 

 

new column =
var _t1 = [Article Code]
return
[Quantity] +
Calculate(
sumx(filter(Table, Table[Contains Tyre] = _t1),[Quantity]) ,
allexcept(table, Table[date])
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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