Forum Discussion
Compare Dates by Index
- Anonymous2 years ago
Hi jaybertx ,
Here are the steps you can follow:
1. Create calculated column.
Count = var _next= MAXX( FILTER(ALL('Table'),'Table'[Payroll ID]=EARLIER('Table'[Payroll ID])&&'Table'[Orientation Index]=EARLIER('Table'[Orientation Index])+1),[Orientation Index]) var _nextdate= MAXX( FILTER(ALL('Table'), 'Table'[Payroll ID]=EARLIER('Table'[Payroll ID])&&'Table'[Orientation Index]=_next),[Orientation Date]) var _datediff= DATEDIFF( 'Table'[Orientation Date],_nextdate,MONTH) return IF( 'Table'[Orientation Index]=1,"Y", IF( _datediff>=6,"Y","N"))2. Result:
When [Payroll ID]=1233 and [Orientation Index]=2, the date difference from [Orientation Index]=3 is only 2 months, which is less than 6 months, so it is N
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi jaybertx ,
Here are the steps you can follow:
1. Create calculated column.
Count =
var _next=
MAXX(
FILTER(ALL('Table'),'Table'[Payroll ID]=EARLIER('Table'[Payroll ID])&&'Table'[Orientation Index]=EARLIER('Table'[Orientation Index])+1),[Orientation Index])
var _nextdate=
MAXX(
FILTER(ALL('Table'),
'Table'[Payroll ID]=EARLIER('Table'[Payroll ID])&&'Table'[Orientation Index]=_next),[Orientation Date])
var _datediff=
DATEDIFF(
'Table'[Orientation Date],_nextdate,MONTH)
return
IF(
'Table'[Orientation Index]=1,"Y",
IF(
_datediff>=6,"Y","N"))
2. Result:
When [Payroll ID]=1233 and [Orientation Index]=2, the date difference from [Orientation Index]=3 is only 2 months, which is less than 6 months, so it is N
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly