Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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 or borught forward.
The modified date can changed based on some other factors other than date change. Below is a sample data and expected output:
Project | Date1 | Modified date |
A | 01-05-2023 | 01-05-2023 |
A | 07-05-2023 | 03-05-2023 |
A | 12-06-2023 | 06-05-2023 |
A | 12-06-2023 | 10-05-2023 |
A | 12-06-2023 | 12-05-2023 |
B | 10-05-2023 | 02-05-2023 |
B | 21-04-2023 | 04-05-2023 |
B | 21-04-2023 | 06-05-2023 |
Output | |||
Project | CurrDate | PrevDate | Var |
A | 12-06-2023 | 07-05-2023 | 36 |
B | 21-04-2023 | 10-05-2023 | -20 |
I have written two measures to get the data, but it seems to be giving me the wrong data and i somewhat know why, can someone please help me with this.
Solved! Go to Solution.
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.
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.