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.
Hey guys! Can someone help me out how to create a new column which calculates the difference of days between each row similiar to the daydifference in this table?
Solved! Go to Solution.
Hi @Joel_sony ,
You can refer to the following steps.
1. Go to power query editor and create new index column.
2. In power bi desktop, create a new calculated column and write the following expression.
DayDifference =
VAR CurrentResponseID = 'Table'[response_id]
VAR CurrentCreatedAt = 'Table'[created_at]
VAR PreviousCreatedAt =
CALCULATE(
MAX('Table'[created_at]),
FILTER(
'Table',
'Table'[response_id] = CurrentResponseID &&
'Table'[id] < EARLIER('Table'[id])
)
)
RETURN
IF(
ISBLANK(PreviousCreatedAt),
0,
ABS(DATEDIFF(PreviousCreatedAt, CurrentCreatedAt, DAY))
)
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Joel_sony ,
Here is the dax for your requirement .
I have given 0 if next date in sequence is not available in case of change in response_id or end of data. Please modify as per need
Did I answer your query ? Mark this as solution if this helps . Appreciate your Kudos.
Cheers.
Neeraj Kumar
Hi @Joel_sony ,
You can refer to the following steps.
1. Go to power query editor and create new index column.
2. In power bi desktop, create a new calculated column and write the following expression.
DayDifference =
VAR CurrentResponseID = 'Table'[response_id]
VAR CurrentCreatedAt = 'Table'[created_at]
VAR PreviousCreatedAt =
CALCULATE(
MAX('Table'[created_at]),
FILTER(
'Table',
'Table'[response_id] = CurrentResponseID &&
'Table'[id] < EARLIER('Table'[id])
)
)
RETURN
IF(
ISBLANK(PreviousCreatedAt),
0,
ABS(DATEDIFF(PreviousCreatedAt, CurrentCreatedAt, DAY))
)
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Joel_sony ,
Appreciate if you share logic behind the calculation. How are you finding daydifference ?
Cheers
This works based on this equation daydifference(created) = daydifference(created)-daydifference(started),
daydifference(started)=daydifference(started)-daydifference(submitted) and continue on until new response_id reaches, When new response_id reaches this process should restart. All values in positive only.
Hello @Joel_sony ,
Here is the dax for your requirement .
I have given 0 if next date in sequence is not available in case of change in response_id or end of data. Please modify as per need
Did I answer your query ? Mark this as solution if this helps . Appreciate your Kudos.
Cheers.
Neeraj Kumar
This works based on this equation daydifference(created) = daydifference(created)-daydifference(started)
daydifference(started)=daydifference(started)-daydifference(submitted) and continue on until new response_id reaches, When new response_id reaches this process should restart. All values in positive only. The same column(daydifference) as in the image
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.