Forum Discussion
How long at each stage
- Anonymous2 years ago
Hi smithub ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a table.
Table = FILTER('Table1','Table1'[Stage] in VALUES('Table2'[Stage]))(3)We can create a column.
Days = var _min=CALCULATE(MIN('Table'[Status Date]),FILTER('Table','Table'[Stage]=EARLIER('Table'[Stage]))) var _max=CALCULATE(MIN('Table'[Status Date]),FILTER('Table','Table'[Stage]>EARLIER('Table'[Stage]))) var _max2=CALCULATE(MIN('Table'[Status Date]),FILTER('Table','Table'[Stage]=" End Stage")) return SWITCH(TRUE(), 'Table'[Status Date]=_min && [Stage] <> " Stage 5" && [Stage]<>" End Stage",DATEDIFF(_min,_max,DAY), 'Table'[Status Date]=_min && [Stage] = " Stage 5" ,DATEDIFF(_min,_max2,DAY))(4) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Table 1 contains Case ID, Status Date and a Stage column that contains over 40 different stages so I created another table - Table 2 with 9 high level stages and mapped the 9 stages in Table 2 to the 40 stages in Table 1.
In my visualisation I want to only show the 9 high level stages coming from Table 2.
Hope this makes sense
Okay yes, that does make sense.
My advice would be to merge Table 2 to Table 1 on the low-level stage field to bring in the high-level stage and then pivot the data as above. (Maybe best to use Merge Queries as New to create a brand new table so you don't lose the original table structures)