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
sdas028
Helper I
Helper I

Seemingly simple CALCULATE OR statement

Hi, I need help with what I thought was going to be a simple calculated measure. 

The data I have has three columns that I need in a larger table: one for Production Area, one for Cost, and one for Trays Packed - what I would like is to calculate the cost per tray for two production areas RK and SP - each of these production areas has their own costs against them however the Trays Packed are only under RK so when I do a simple cost/trays calculation nothing comes up for SP. What I want is SP $/RK Trays effectively. I tried creating a measure for Trays Packed = SUM(Trays Packed) and then dividing cost by that but it still comes up blank. I then tried a CALCULATE (SUM(cost), FILTER(production Area = "RK" OR "SP"))/Repack Trays but this didnt work either. I have the cost and trays packed in a matrix so each time I put the measure into the table it has values under RK but nothing or infinity under SP.

Hopefully that all made sense!

1 ACCEPTED SOLUTION

Hi @sdas028,

I understand that you want to get the Trays Packed of Production Area of RK, when the Production Area is SP where it is NULL actually.

 

You can use the following DAX statements to meet your requirement

 

1. Create the following Calculated Column

 

Trays Packed = IF(Data[Production Area] = "SP", CALCULATE(AVERAGEX(Data,Data[Trays packed]),FILTER(Data,Data[Production Area]="RK")), Data[Trays packed])

The Above column with have No. of Trays packed for all the Production Areas

 

2. now create Cost per Tray calculated column as shown below

 

Cost per Tray = Data[Labour Cost]/ Data[Trays Packed]

The Resulting output will look as shown below

pic.PNG

 

 

Hope this helps!!!

 

View solution in original post

5 REPLIES 5
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @sdas028,

 

If it is convenient, could you please share some data smple and your desired output so that I could understand your scenario better and get the solution?

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

Apologies for the delay in replying. Here is a really simple example of the data I have:

Labour CostTrays packedProduction Area
$1001000CCK
$2002000RK
$1501500RK
$1001000RK
$2502500RK
$50 SP
$150 SP
$200 SP
$250 SP

 

Basically I want to calculate the total cost of each production type but because SP doesnt have any trays packed against it I want it to be calculated on the RK trays

 

Hope that helps

Thanks,

Sophie

Hi @sdas028,

 

Have you solved your problem?

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share your desired output.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

I understand the concept of the PowerBI community, thank you.

 

I dont always have time to check my powerBI notifications as this isn't the only thing I am working on.

 

I have accepted your answer as the solution for your convenience.

Hi @sdas028,

I understand that you want to get the Trays Packed of Production Area of RK, when the Production Area is SP where it is NULL actually.

 

You can use the following DAX statements to meet your requirement

 

1. Create the following Calculated Column

 

Trays Packed = IF(Data[Production Area] = "SP", CALCULATE(AVERAGEX(Data,Data[Trays packed]),FILTER(Data,Data[Production Area]="RK")), Data[Trays packed])

The Above column with have No. of Trays packed for all the Production Areas

 

2. now create Cost per Tray calculated column as shown below

 

Cost per Tray = Data[Labour Cost]/ Data[Trays Packed]

The Resulting output will look as shown below

pic.PNG

 

 

Hope this helps!!!

 

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