Forum Discussion
icbd
Helper I
4 years agoTotal planned production time calculation
Good morning everyone. I am using PowerBI to visualize data in a SQL database. I am trying to make a measurement that will calculate the total planned production times. I have three different...
- 4 years ago
I was able to do this properly using the following by creating a calculated column containing the Date&ShiftId. I named this ShiftDate.
From there, I used the following DAX formula:
SUMX((DISTINCT(DataPartCell1[ShiftDate])), FIRSTNONBLANK(DataPartCell1[ShiftLength],0))
lbendlin
Super User
4 years agoThank you for the context. Please provide a couple more rows of sample data (to cover the "missing shift" case, for example) and indicate expected results.
icbd
Helper I
4 years agoNo problem, sorry it took me a bit to have some time in the office for this issue. Here's a quick extract which shows the relevant columns.
| Id | Time | SerialNumber | Hour | ShiftHour | ShiftId | Date | Shift | ShiftRunTime | ShiftLength |
| 16704409 | 2021-10-18 15:45 | Modified1 | 15 | 15,75 | 1 | 2021-10-18 | Day | 8 | 7,5 |
| 16704412 | 2021-10-18 15:45 | Modified2 | 15 | 15,75 | 1 | 2021-10-18 | Day | 8 | 7,5 |
| 16704416 | 2021-10-18 15:45 | Modified3 | 15 | 15,75 | 1 | 2021-10-18 | Day | 8 | 7,5 |
| 16704422 | 2021-10-18 15:46 | Modified4 | 15 | 15,766666 | 2 | 2021-10-18 | Evening | 0,016666 | 7 |
| 16704424 | 2021-10-18 15:46 | Modified5 | 15 | 15,766666 | 2 | 2021-10-18 | Evening | 0,016666 | 7 |
| 16704425 | 2021-10-18 15:46 | Modified6 | 15 | 15,766666 | 2 | 2021-10-18 | Evening | 0,016666 | 7 |
What I would need is some measure that will, for each date, sum the distinct values in the ShiftLength column.