Forum Discussion
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 number | ID number | Condition |
| 31 | 1 | Good |
| 31 | 2 | Bad |
| 32 | 3 | Bad |
| 32 | 4 | Good |
| 32 | 5 | Good, 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
- ToddChitt
Super User
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.
- Matski469Frequent 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.