Forum Discussion

Matski469's avatar
Matski469
Frequent Visitor
3 years ago
Solved

Need to graph weekly yield by value

I have manufacturing data coming in that says whether a part is good, bad, or some category in between.  The data is item by item, so I'm trying to count the values.  What I can't seem to do is calculate a simple yield of x good/x total per week.  I can use the ALL () to get everything that I'm looking at, but that doesn't help.  I've tried ALL, ALLSELECTED, CALCULATE, FILTER, banging head against wall, etc.   

 

example of data is:

Week numberID numberCondition
311Good
312Bad
323Bad
324Good
325Good, except A

 

What I expect is:

Week 31 = 50% (1 good, 2 total)

Week 32 = 33% (1 good, 3 total)

 

And in a visual, I should be able to graph (line) the data by week and see it go from 50% to 33%, and then add in the "good, except A" value and see week 32  go to 67%.

 

Searching seems to get be close, but not there.  So I'm hoping someone can help.

 

  • Try these measures:

    My Count of Good = CALCULATE ( COUNTROWS(MyTable), [Condition] = "Good" )

    Total Rows = COUNTROWS(MyTable)

    Percent Good = DIVIDE( [My Count of Good], [Total Rows], 0 )

     

    All those measures will respect the weekly slice when you plot.

2 Replies

  • Try these measures:

    My Count of Good = CALCULATE ( COUNTROWS(MyTable), [Condition] = "Good" )

    Total Rows = COUNTROWS(MyTable)

    Percent Good = DIVIDE( [My Count of Good], [Total Rows], 0 )

     

    All those measures will respect the weekly slice when you plot.

  • Matski469's avatar
    Matski469
    Frequent Visitor

    Thank you, that helped.  I've been spending a lot of time on the power query side, and am just now getting used to the DAX side.  Specifically getting used to measures.