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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
paris
Helper V
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!

 

powerbidefective.JPG

 

All the best,

Paris

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
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:

vangzhengmsft_0-1626060278165.png

 

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.

View solution in original post

2 REPLIES 2
v-angzheng-msft
Community Support
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:

vangzhengmsft_0-1626060278165.png

 

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.

Hello Zeon Zheng,

 

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

 

Thank you again,

All the best,

Paris

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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