Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I'm trying to calculate the days each Work Order has spent in its current Process Step. The data is automatically appended every morning. Below is an example of the data for each Work Order, the last column (Days in Current Process Step) is what I'm trying to calculate automatically.
In reality this data set has multiple Work Orders for each day.
Solved! Go to Solution.
Hi @tblackburn,
Please create calculated columns using below DAX formulas in source table (in my test, it's named as 'Work Order').
New Col1 = VAR lastdaypull = CALCULATE ( MAX ( 'Work Order'[Day Pulled] ), ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] < EARLIER ( 'Work Order'[Day Pulled] ) ) RETURN IF ( CALCULATE ( LASTNONBLANK ( 'Work Order'[Current Process Step], 1 ), FILTER ( ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] = lastdaypull ) ) <> 'Work Order'[Current Process Step], 1, 0 )
New Col2 = CALCULATE ( SUM ( 'Work Order'[New Col1] ), FILTER ( ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] <= EARLIER ( 'Work Order'[Day Pulled] ) ) )
Days in Current Process Step = RANKX ( FILTER ( 'Work Order', 'Work Order'[Work Order] = EARLIER ( 'Work Order'[Work Order] ) && 'Work Order'[New Col2] = EARLIER ( 'Work Order'[New Col2] ) ), 'Work Order'[Day Pulled], , ASC, DENSE )
As resource data is automatically appended every morning, each time you open this report, please refresh report page manually, the table view will be updated to latest data.
Regards,
Yuliana Gu
Hi @tblackburn,
Please create calculated columns using below DAX formulas in source table (in my test, it's named as 'Work Order').
New Col1 = VAR lastdaypull = CALCULATE ( MAX ( 'Work Order'[Day Pulled] ), ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] < EARLIER ( 'Work Order'[Day Pulled] ) ) RETURN IF ( CALCULATE ( LASTNONBLANK ( 'Work Order'[Current Process Step], 1 ), FILTER ( ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] = lastdaypull ) ) <> 'Work Order'[Current Process Step], 1, 0 )
New Col2 = CALCULATE ( SUM ( 'Work Order'[New Col1] ), FILTER ( ALLEXCEPT ( 'Work Order', 'Work Order'[Work Order] ), 'Work Order'[Day Pulled] <= EARLIER ( 'Work Order'[Day Pulled] ) ) )
Days in Current Process Step = RANKX ( FILTER ( 'Work Order', 'Work Order'[Work Order] = EARLIER ( 'Work Order'[Work Order] ) && 'Work Order'[New Col2] = EARLIER ( 'Work Order'[New Col2] ) ), 'Work Order'[Day Pulled], , ASC, DENSE )
As resource data is automatically appended every morning, each time you open this report, please refresh report page manually, the table view will be updated to latest data.
Regards,
Yuliana Gu
Thank you! Works like a charm!
Help me...someone...you're my only hope!
Hello!
Try this formula of calculate column
Days in Current Process Step =
CALCULATE (
COUNTROWS ( Table ),
FILTER (
Table,
Table[Day Pulled] <= EARLIER ( Table[Day Pulled] )
&& Table[Work order] = EARLIER ( Table[Work order] )
&& Table[Product Name] = EARLIER ( Table[Product Name] )
&& Table[Serial Number] = EARLIER ( Table[Current Process Step] )
&& Table[Current Process Step] = EARLIER ( Table[Current Process Step] )
)
)
User | Count |
---|---|
102 | |
91 | |
87 | |
79 | |
71 |
User | Count |
---|---|
113 | |
105 | |
101 | |
75 | |
64 |