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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Lunden
Regular Visitor

Calculate SUM with two filters

Hi I really need some help,

 

I need to calculate a sum for Column Comp.Qty (BUn) in a newcolumn (SUM BUn All BareAxles) if column Bare Axles and column Component contain the same value

 

Lunden_0-1650366282442.png

 

This it what I have this far:

 

SUM BUn All BareAxles = CALCULATE(SUM(BareAxleAll[Comp. Qty (BUn)]),
FILTER (BareAxleAll, BareAxleAll[Component number] = EARLIER (BareAxleAll[Component number]
)))
 

Thanks  Maria

8 REPLIES 8
Anonymous
Not applicable

Hi @Lunden,

Any update for these? Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

SpartaBI
Community Champion
Community Champion

Are you sure?? 🙂
Why is there 2 letters in the 2nd column?

Not sure yet what you want, but try this:

SUM BUn All BareAxle =
IF(
'Table'[Bare Axels] = 'Table'[Component],
SUMX(
FILTER(
'Table',
'Table'[Bare Axels] = 'Table'[Component]
),
'Table'[Comp. Qty (BUn)]
),
'Table'[Comp. Qty (BUn)]
)

Maby  it would be better do do a mesure for this?

 

😉

SpartaBI
Community Champion
Community Champion

For sure. Unless you need it for slice and dice in visuals, and only need it as value to show, 99% would be better to do in a measure. 
I still don't understand your data 😞
Could you maybe share a sampe of the data here so I could copy it easily and create the measure.
Put the same column names etc so you could just copy paste the code I will (hopefully haha) send

As you  can see here, I get the total  sum "8" for all Bare Axle (first column),  I would like to get the sum of "Comp. Qty (BUn)" for each Bare axle = 1 in the case in the pictu

 re, i will use the result for a calculation to prognose the need of each component depending on volume on each bare axle

 

Lunden_2-1650377378206.png

 

 

 

Hi,

 

The colum "Bare Axle" haved 8 different part numbers, (level 1)  this is the main part number for a complete unit. The 8 different Bare Axles then contains of 200-300 different parts who are in column "components", some are in every bare axle, and might also occur severel times in the column bare axle with the same partnumber and component number.  The column "Comp. Qty (BUn)" tells how many components needed for each row in the structure for the Bare Axle

 

I need the total sum ("Comp. Qty (BUn)")  of each component number in column "component"  for every  bare axle,

 

I'm not sure i managed to explain so it is easy for you to understand, please ask if it is unclear for youu if i can explain differently

 

Great thanks Maria

SpartaBI
Community Champion
Community Champion

Hey Maria,
Not sure why you want this in a column and not a measure.
Can you show me what number do you want it to be in each row in this sample table:

SpartaBI_0-1650369300040.png

Than I will write back the formula 



Bare AxlesComponentComp. Qty (Bun) SUM Bun All BareAxles
ABA1020
ACA1010
BBA1010
CAA1010
ABA1020
CCA1010

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.