Forum Discussion
Mariska123
8 years agoFrequent Visitor
Calculate date difference
Hi Community, I'm trying to calculate the date difference between the bold dates: Client_NR Sit_NR Mutation Input Start Date End Date 1 1 NW 1-3-2015 1-4-2015 28-2-2016 1 ...
Phil_Seamark
8 years agoMicrosoft Employee
HI Mariska123
Is the value you want to calculate always between two records with consecutive Sit_NR numbers?
- Mariska1238 years agoFrequent Visitor
Hi Phil_Seamark,
Yes, that's right. The date I want to create is the difference between the startdate of mutation = NW and the inputdate of the mutation = SC
- parry2k8 years agoSuper User
try this measure
Days Difference = var y = calculate(max(Dt[Start Date]), Filter(ALLSELECTED(Dt), Dt[Sit_NR] < max( Dt[Sit_NR] ))) return datediff(y, MAX(Dt[Input]), DAY)
- Phil_Seamark8 years agoMicrosoft Employee
Are there always just 2 rows, or are there subsequent SC rows that you would also like a DATEDIFF calculated for?
- Mariska1238 years agoFrequent Visitor
The mutation column can have up to 6 different values. The client will always hav the NW mutation, but not necessarily one of the others. I only want to calculate the date difference if both mutations NW and SC are available for the client.