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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
TheBarron
New Member

Calculated Column - SUM Based on Criteria from Multiple Columns in Table

Hi all

 

Been struggling on this one, and got a lot of the way there with CALCULATE, SUM, SUMX, FILTER etc however need to turn to the experts now.

 

Costing a set of items as they roll through production process across different material types. W -> GB -> DH -> BB -> FP. Need associated costs from each stage to roll up under relevant types.

 

Aiming to recreate the M column in PBI - formula within current cell is:

=IF(F2="RM: M",(E2*D2)/B2,IF(OR(LEFT(F2,2)="FP",LEFT(F2,3)="WIP"),SUMIF(A:A,C2,G:G)*(D2/B2),0))

 

Basically if Group = RM: M - do calulcation - this is fine, the bit i am having trouble with is the second part:

IF(OR(LEFT(F2,2)="FP",LEFT(F2,3)="WIP"),SUMIF(A:A,C2,G:G)*(D2/B2),0)

 

If Group begins either FP or WIP sumif column G (labelled M) based on item in column C from criteria in A then perform said calculation.

 

I can seem to get it for one level up as in i can work from GB and will sum for W but for DH and beyond it returns 0 - any help appreciated

 

thumbnail_Screenshot 2024-01-03 121715.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @TheBarron ,

If I understand correctly, the issue is that you want to sum from multiple columns. Please try the following methods and check if they can solve your problem:

1.Create a calculated column.

RM_M_Cost = IF([Group] = "RM: M", ([E] * [D]) / [B], BLANK())

 

2.Add a calculated column for FP condition.

FP_WIP_Cost =
IF( OR(LEFT([F], 2) = "FP", LEFT([F], 3) = "WIP"),
CALCULATE( SUM([G]),
FILTER( ALL('Table'), 'Table'[A] = EARLIER('Table'[C]) ) ) * ([D] / [B]), 0 )

 

3.You can create a final calculated column that combines both conditions.

Final_Cost =
IF(
    NOT(ISBLANK([RM_M_Cost])), [RM_M_Cost], [FP_WIP_Cost] )

 

If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format or screenshot to make a deep troubleshooting? It would be helpful to find out the solution.

 

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @TheBarron ,

If I understand correctly, the issue is that you want to sum from multiple columns. Please try the following methods and check if they can solve your problem:

1.Create a calculated column.

RM_M_Cost = IF([Group] = "RM: M", ([E] * [D]) / [B], BLANK())

 

2.Add a calculated column for FP condition.

FP_WIP_Cost =
IF( OR(LEFT([F], 2) = "FP", LEFT([F], 3) = "WIP"),
CALCULATE( SUM([G]),
FILTER( ALL('Table'), 'Table'[A] = EARLIER('Table'[C]) ) ) * ([D] / [B]), 0 )

 

3.You can create a final calculated column that combines both conditions.

Final_Cost =
IF(
    NOT(ISBLANK([RM_M_Cost])), [RM_M_Cost], [FP_WIP_Cost] )

 

If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format or screenshot to make a deep troubleshooting? It would be helpful to find out the solution.

 

Best Regards

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.