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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
TcT85
Helper III
Helper III

Can't get the correct calculation on second attribute

Hi,

 

Description of issue.

I got two tables, one table contains the the bill of materials(BOM) of the product the second table that contain the defects.

When I correlate with "Product" column between the 2 tables, I can calculate the Yield and DPMO on the product level.

But when I want the Yield and DPMO on the Fruit level the calculations is getting completely wrong.

 

Data

BOM

ProductFruitPositionTotal Pieces
AAppleA16
AAppleA26
AAppleA36
AAppleA46
AOrangeO15
AOrangeO25
AOrangeO35
AOrangeO45
AOrangeO55
AStrawberryS12
AStrawberryS22
AStrawberryS32
AStrawberryS42
AStrawberryS52
AStrawberryS62
ATamarinT13
BAppleA16
BAppleA26
BAppleA36
BStrawberryS12
BStrawberryS22
BStrawberryS32
BWatermelonW18
BWatermelonW28

 

Production

ProductSerialNumberFruitPositionPieceDefectsDefect Type
A223355AppleA11NGRotten
A223355AppleA42NGRotten
A223355OrangeO14NGMishaped
A223355OrangeO25NGRotten
A223355OrangeO56NGMishaped
A223355StrawberryS11NGRotten
A223355StrawberryS22NGMishaped
A223356   OK 
A223357   OK 
A223358   OK 
A223359   OK 
A223360   OK 
A223361   OK 
A223362   OK 
A223363   OK 
A223364   OK 
A223365   OK 
A223366   OK 
A223367   OK 
A333555AppleA22NGRotten
A333555AppleA22NGMishaped
A333555OrangeO14NGMishaped
A333555OrangeO25NGRotten
B445566AppleA15NGRotten
B445566AppleA31NGMishaped
B445566StrawberryS11NGRotten
B445566StrawberryS21NGRotten
B445566StrawberryS32NGRotten
B445567   OK 
B445568   OK 
B445569   OK 
B445570   OK 
B445571   OK 
B445572   OK 
B445573   OK 

 

DAX formulas that is needed.

Fruit Yield

Fruit DPMO ( the Data that is highlithed in Bold text has 2 rows that should be calculated as one opportunity).

 

DAX formula that works.

Yield Product Defect =
VAR UniqeSerial =
CALCULATE(
DISTINCTCOUNT(Production[SerialNumber])
)
VAR DefectSerial =
CALCULATE(
DistinctCOUNT(Production[SerialNumber]),FILTER(Production,Production[Defects] ="NG")
)
VAR YieldDefect = DefectSerial/UniqeSerial
Return
1- YieldDefect

 

It's hard to explain in exact detail where it get's wrong, but please try these table and correlate with product.

 

3 REPLIES 3
TcT85
Helper III
Helper III

Here is where I get stuck.

When i try to calculate from BOM Table with Total Fruit used and with Total Defects Fruit, i cant get the crrect calculation on Total Defect Fruits. And vice versa with calculation from Production Table I get issue with Total Fruit.

 

TcT85_0-1694779971737.png

 

TcT85
Helper III
Helper III

Sorry for asking again, could anyone help me with this issue? Im really stuck with this issue and can't continue build my report.

TcT85
Helper III
Helper III

Does anyone know if this is solvable? 

Or do I need to merge this into 1 table? I think it would work with this sample data, but now with my production data due to millions of row of data, the data above is just fictional.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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