cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper V

## How to calculate % of defect vs production

Hi All,

I have a list of a table of defective value / total value by date and factory location.

In E2, I like to show the result of D10 / D5 , could you please help!

All the best,

Paris

1 ACCEPTED SOLUTION
Community Support

Hi, @paris

Based on the above data, I guess there is an error in the description, E2=D2/D5 instead of D10/D5.

So, try to create a measure like this:

``````Measure =
VAR _def =
CALCULATE (
SUM ( [Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Factory] ),
[ltem] = "Defective"
)
)
VAR _Total =
CALCULATE (
SUM ( [Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Factory] ),
[ltem] = "Total"
)
)
RETURN
IF ( MAX ( [ltem] ) = "Total", BLANK (), DIVIDE ( _def, _Total )
``````

Result:

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

2 REPLIES 2
Community Support

Hi, @paris

Based on the above data, I guess there is an error in the description, E2=D2/D5 instead of D10/D5.

So, try to create a measure like this:

``````Measure =
VAR _def =
CALCULATE (
SUM ( [Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Factory] ),
[ltem] = "Defective"
)
)
VAR _Total =
CALCULATE (
SUM ( [Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Date], 'Table'[Factory] ),
[ltem] = "Total"
)
)
RETURN
IF ( MAX ( [ltem] ) = "Total", BLANK (), DIVIDE ( _def, _Total )
``````

Result:

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

Helper V

Hello Zeon Zheng,

Thank you so much for your help. It worked nicely , thank you again.

Thank you again,

All the best,

Paris

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors