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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello all
I have a formula which calculates the days between two operations:
Solved! Go to Solution.
Hi @Tommyvhod ,
Based on your description, I have created a simple sample:
Please try:
add an index column:
Then apply the measure:
Aging =
var _time =
MAX(Data[Datum trans])
var _index = MAX('Data'[Index])
VAR _maxLastTime =
CALCULATE(MAX(Data[Datum trans]),
FILTER(ALLEXCEPT(Data, Data[ID]), [Index]=_index-1)
)
VAR _datedif =
DATEDIFF(_maxLastTime,_time,DAY)
Return
IF(_datedif >0,_datedif,0)
Final 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.
Thank you. Yes the index column was a good Idea. What I also changed is the
IF(_datedif >0,_datedif,0)
To _datedif, Blank()) so the visual wont show unecessary columns
Hi @Tommyvhod ,
Based on your description, I have created a simple sample:
Please try:
add an index column:
Then apply the measure:
Aging =
var _time =
MAX(Data[Datum trans])
var _index = MAX('Data'[Index])
VAR _maxLastTime =
CALCULATE(MAX(Data[Datum trans]),
FILTER(ALLEXCEPT(Data, Data[ID]), [Index]=_index-1)
)
VAR _datedif =
DATEDIFF(_maxLastTime,_time,DAY)
Return
IF(_datedif >0,_datedif,0)
Final 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.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |