Forum Discussion
Kish1999
3 years agoHelper II
Get Current and previous date
Helo All, I Have a requirement where we have to check if a particular date has been changed and if it has been changed then find by how many days it has been changed. The date can be pushed back ...
- 3 years ago
Hi Kish1999 ,
Please try:
CurrDate = var _a = MAX('Table'[Modified date]) return CALCULATE(MAX('Table'[Date1]),FILTER('Table',[Modified date]=_a)) PrevDate = var _a = [CurrDate] var _b = CALCULATE(MIN('Table'[Modified date]),FILTER('Table',[Date1]=_a)) var _c = CALCULATE(MAX('Table'[Modified date]),FILTER('Table',[Modified date]<_b)) return CALCULATE(MAX('Table'[Date1]),FILTER('Table',[Modified date]=_c)) Var = DATEDIFF([PrevDate],[CurrDate],DAY)Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jianboli-msft
3 years agoCommunity Support
Hi Kish1999 ,
Please try:
CurrDate =
var _a = MAX('Table'[Modified date])
return CALCULATE(MAX('Table'[Date1]),FILTER('Table',[Modified date]=_a))
PrevDate =
var _a = [CurrDate]
var _b = CALCULATE(MIN('Table'[Modified date]),FILTER('Table',[Date1]=_a))
var _c = CALCULATE(MAX('Table'[Modified date]),FILTER('Table',[Modified date]<_b))
return CALCULATE(MAX('Table'[Date1]),FILTER('Table',[Modified date]=_c))
Var = DATEDIFF([PrevDate],[CurrDate],DAY)
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.