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

How to calculate the production yield trend by date

Hi Experts:

   I have a raw data like below table , I want to check the production yield by Date, the yield is total PASS item divide the total item, then I want to get a chart like below line chart, it will show the yield trend by Month/Year/Week, and the different inspector will be shown by different colo. Also if there isn't any inspection during the Month/Week, the line chart will be shown nothing in that Month/Week and it can't be shown as 0% or 100%.

   Could you help me with the requirement? Thank you very much!!!

 

InspectorDateResult
A2022/10/1PASS
A2022/11/1PASS
A2022/12/1FAIL
B2022/11/4FAIL
B2022/11/5PASS
B2022/10/1FAIL
B2022/11/1FAIL
C2022/12/1PASS
C2022/11/9PASS
C2022/11/10FAIL
D2022/11/11PASS
D2022/10/1PASS

 

 

york_0-1667983174838.png

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

I see what you mean. Change the measure to:

Yield =
VAR _Pass =
    CALCULATE (
        COUNT ( fTable[Result] ),
        FILTER ( 'Result table', 'Result table'[Result] = "PASS" )
    )
VAR _ALL =
    COUNT ( fTable[Result] )
RETURN
    IF ( AND ( ISBLANK ( _Pass ), _ALL > 0 ), 0, DIVIDE ( _Pass, _ALL ) )


What do you mean by "there isn't the inspector's line in the line chart shown by Month/Week"?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

See if this works. First, the model:

model.jpgThe measure:

 

Yield =
VAR _Pass =
    CALCULATE (
        COUNT ( fTable[Result] ),
        FILTER ( 'Result table', 'Result table'[Result] = "PASS" )
    )
VAR _ALL =
    COUNT ( fTable[Result] )
RETURN
    DIVIDE ( _Pass, _ALL )

 

Set up the line visual using the fields from the dimension tables and the measure.

set up.jpg

 Click on the dropdown for "WeekNum" and select "Show items with no data"

no data.jpg

And you will get:

yield gif.gif

Sample PBIX file attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul:

  It worked!!!! Thank you very much, but I have a question, there is a inspector and his yield is 0% from 2022/10 to 2022/11, why the line chart doesn't show 0% when I count the total yield by inspector? And there isn't the inspector's line in the line chart shown by Month/Week?

york_0-1667988140307.png

 

PaulDBrown
Community Champion
Community Champion

I see what you mean. Change the measure to:

Yield =
VAR _Pass =
    CALCULATE (
        COUNT ( fTable[Result] ),
        FILTER ( 'Result table', 'Result table'[Result] = "PASS" )
    )
VAR _ALL =
    COUNT ( fTable[Result] )
RETURN
    IF ( AND ( ISBLANK ( _Pass ), _ALL > 0 ), 0, DIVIDE ( _Pass, _ALL ) )


What do you mean by "there isn't the inspector's line in the line chart shown by Month/Week"?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul:

  It's really nice of you!!!!! All of my questions have been solved!!!😉

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.