Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
nataliesmiy1357
Helper IV
Helper IV

Time in between Formula

Good afternoon!

 

I am looking to create a formula/measure to capture how much time is between each row/entry.

 

I have the AI_Start_Time and then AI_Norm_Time.

 

I need to make a formula that shows the difference in time between entry 1's AI_Norm_Time, and entry 2's AI_Start_Time

(ex: Time between 10/14/2023 6:35:54AM and 10/14/2023 6:46:36AM = 10 minutes and 42 seconds.)

 

Entry NumberAI_Start_TimeAI_Norm_Time
110/14/2023 6:35:52AM   10/14/2023 6:35:54AM 
210/14/2023 6:46:36AM 10/14/2023 6:46:38AM

 

 

2 ACCEPTED SOLUTIONS
mark_endicott
Super User
Super User

@nataliesmiy1357 - it's not clear how you want to present this, but I've attached a PBIX file with a solution. 

 

It shows the time in DD:HH:MM:SS format

 

mark_endicott_0-1736359181468.png

 

If this works for you please accept as the solution. It helps others with the same challenge. 

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

 

 

Jihwan_Kim_1-1736358792227.png

 

 

OFFSET function (DAX) - DAX | Microsoft Learn

 

 

Difference in seconds CC =
VAR _normtime = Data[AI_Norm_Time]
VAR _nextrowstarttime =
    MAXX (
        OFFSET (
            1,
            Data,
            ORDERBY ( Data[Entry Number], ASC ),
            ,
            ,
            MATCHBY ( Data[Entry Number] )
        ),
        Data[AI_Start_Time]
    )
RETURN
    DATEDIFF ( _normtime, _nextrowstarttime, SECOND )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

3 REPLIES 3
mark_endicott
Super User
Super User

@nataliesmiy1357 - Did either me or @Jihwan_Kim  solve this for you?

 

Accepting the solution helps other people find the answers on this forum, so please do this or let us know what else you need.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

 

 

Jihwan_Kim_1-1736358792227.png

 

 

OFFSET function (DAX) - DAX | Microsoft Learn

 

 

Difference in seconds CC =
VAR _normtime = Data[AI_Norm_Time]
VAR _nextrowstarttime =
    MAXX (
        OFFSET (
            1,
            Data,
            ORDERBY ( Data[Entry Number], ASC ),
            ,
            ,
            MATCHBY ( Data[Entry Number] )
        ),
        Data[AI_Start_Time]
    )
RETURN
    DATEDIFF ( _normtime, _nextrowstarttime, SECOND )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

mark_endicott
Super User
Super User

@nataliesmiy1357 - it's not clear how you want to present this, but I've attached a PBIX file with a solution. 

 

It shows the time in DD:HH:MM:SS format

 

mark_endicott_0-1736359181468.png

 

If this works for you please accept as the solution. It helps others with the same challenge. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.