Forum Discussion
Opportunity stage duration
- 6 years ago
nanma94 try measure below and here is the result.
Days between Stages = VAR __oppyId = SELECTEDVALUE ( Oppy[OpportunityId] ) VAR __Stage = MAX ( 'Oppy Detail'[Stage #] ) VAR __StageDate = MAX ( 'Oppy Detail'[CreatedDate] ) VAR __prevStage = MAX ( __Stage - 1, 1 ) VAR __prevStageDate = CALCULATE ( MAX ( 'Oppy Detail'[CreatedDate] ), ALL ( 'Oppy Detail' ), Oppy[OpportunityId] = __OppyId, 'Oppy Detail'[Stage #] = __prevStage ) RETURN DATEDIFF( __prevStageDate, __StageDate, DAY )Would appreciate Kudos 🙂 if my solution helped.
nanma94 which date to pick when oppy has same stage twice, like in your example, oppy #1 has two closed won stages on different dates
nanma94 try measure below and here is the result.
Days between Stages =
VAR __oppyId = SELECTEDVALUE ( Oppy[OpportunityId] )
VAR __Stage = MAX ( 'Oppy Detail'[Stage #] )
VAR __StageDate = MAX ( 'Oppy Detail'[CreatedDate] )
VAR __prevStage = MAX ( __Stage - 1, 1 )
VAR __prevStageDate =
CALCULATE (
MAX ( 'Oppy Detail'[CreatedDate] ),
ALL ( 'Oppy Detail' ),
Oppy[OpportunityId] = __OppyId,
'Oppy Detail'[Stage #] = __prevStage
)
RETURN DATEDIFF( __prevStageDate, __StageDate, DAY )
Would appreciate Kudos 🙂 if my solution helped.
- nanma946 years ago
Helper III
I've had a calculated column that works to average by stage. But this measure provides more flexibility. Thank you so much!
- Cortana4 years ago
Helper IV
Hello parry2k .
If I get it correctly, you are calculating stage duration, right? I mean the total time it takes in each stage.
If so, then for the first opportunity the total days for staying in stage 4 would be 11 days. But it's not showing that. I am confused. Can you help to understand that?