Forum Discussion
Average Pieces Per Shift
Attempting to get Average Pieces Per Shift. Dig, dig, dig, but haven't found the answer.
Given a filtered list of detail production transactions, I need to summarize them by Date, Shift with a sum of the Good Pieces. Then, count the Dates and Shifts and resum the Good Pieces. Then, calculate the Average Pieces per Shift:
Incoming rows are detail with multiple records per Date, Shift.
Incoming rows are summarized by Year, Month, Shift, and Good Pieces. Count of shifts cannot be done yet:
Now, the count of shifts can be accumulated along with the total of good pieces:
| Year | Month | Shift | Shift Count | Good Pieces |
| 2018 | 10 | 1 | 5 | 3600 |
| 2018 | 10 | 2 | 4 | 936 |
| 2018 | 10 | 3 | 4 | 3168 |
I cannot get the correct Shift Count. No problem with Good Pieces.
Have tried:
Shift Count = CALCULATE(DISTINCTCOUNT(dim_date[Date]))
Shift Count 2 = COUNTROWS(SUMMARIZE(fact_production,dim_date[Date],dim_shift[Shift]))
Shift Count 3 = COUNTX (
SUMMARIZE (
fact_production,
dim_date[Date],
dim_shift[Shift],
"Count", COUNT ( dim_shift[Shift] )
),
[Count]
)Can you point me in the right direction?
- Anonymous6 years ago
HI BrianBollmann ,
According to your description and snapshot, I think you want to get the distinct count of the current group(year, month, shift), right?
If this is a case, you can try to use the following measure formula if it suitable for your requirement:
Shift count = CALCULATE ( DISTINCTCOUNT ( Table[Date] ), ALLSELECTED ( Table ), VALUES ( Table[Year] ), VALUES ( Table[Month] ), VALUES ( Table[Shift] ) )Regards,
Xiaoxin Sheng
2 Replies
- mwegenerMost Valuable Professional
Hi,
I think you have to count the key column of the fact table.
Shift Count = DISTINCTCOUNT(fact_production[Date])If I answered your question, please mark my post as solution, this will also help others.Please give Kudos for support. - AnonymousNot applicable
HI BrianBollmann ,
According to your description and snapshot, I think you want to get the distinct count of the current group(year, month, shift), right?
If this is a case, you can try to use the following measure formula if it suitable for your requirement:
Shift count = CALCULATE ( DISTINCTCOUNT ( Table[Date] ), ALLSELECTED ( Table ), VALUES ( Table[Year] ), VALUES ( Table[Month] ), VALUES ( Table[Shift] ) )Regards,
Xiaoxin Sheng