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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
RhodesBrown
Frequent Visitor

Time in Status

Hi All

 

Essentially I'm trying to add a new column that measures how long in hrs and minutes each row spent in that status . 


For instance how long did it take row 2 to go to row 1 (Relationship Consultant Engage + Input) being 22/03/2023 16:39:30 minus 22/03/2023 08:35:19. And then if the new status = the current status e.g row 1, how long has it been in that status. This obviously needs to be specific to the Name column. Any help would be appreciated

 

 

 

NameNew StatusOld StatuscreatedonCurrent Status
Gastropay LimitedFull Application CreatedRelationship Consultant Engage + Input22/03/2023 16:39:30Full Application Created
Gastropay LimitedRelationship Consultant Engage + InputFinal Risk Assessment + Sign Off22/03/2023 08:35:19Full Application Created
Gastropay LimitedFinal Risk Assessment + Sign OffRelationship Consultant Engage + Input22/03/2023 08:35:14Full Application Created
Gastropay LimitedRelationship Consultant Engage + InputAwaiting Client Sign Off22/03/2023 08:35:12Full Application Created
Paynes Trains LimitedClient Account CreationAwaiting Client Sign Off15/03/2023 14:49:27Client Account Creation
Paynes Trains LimitedAwaiting Client Sign OffFinal Risk Assessment + Sign Off15/03/2023 14:49:16Client Account Creation
Paynes Trains LimitedFinal Risk Assessment + Sign OffRelationship Consultant Engage + Input15/03/2023 14:29:55Client Account Creation
Paynes Trains LimitedRelationship Consultant Engage + InputFull Application Created15/03/2023 09:55:10Client Account Creation
Paynes Trains LimitedFull Application CreatedInitial Application15/03/2023 09:55:04Client Account Creation
Firestone Property LimitedFinal Risk Assessment + Sign OffRelationship Consultant Engage + Input14/03/2023 13:05:04Final Risk Assessment + Sign Off
Firestone Property LimitedRelationship Consultant Engage + InputFinal Risk Assessment + Sign Off13/03/2023 15:55:44Final Risk Assessment + Sign Off
1 ACCEPTED SOLUTION
ahmedoye
Responsive Resident
Responsive Resident

Try the below: (Just change references to "Table" to the original name of your table. If it works, kindly mark it as a solution so anyone who needs a similar solution in future can easily find it.

 

Column =
VAR CurrentCreatedon = 'Table'[createdon]
VAR CurrentName = 'Table'[Name]
VAR NextTime =
    MINX (
        TOPN (
            1,
            FILTER (
                'Table',
                'Table'[createdon] > CurrentCreatedon
                    && 'Table'[Name] = CurrentName
            ),
            'Table'[createdon], ASC
        ),
        'Table'[createdon]
    )
VAR TimeDifferenceM =
    DATEDIFF ( CurrentCreatedon, NextTime, MINUTE )
VAR TimeDifferenceS =
    DATEDIFF ( CurrentCreatedon, NextTime, SECOND )
VAR TodayCurrentTime =
    NOW ()
VAR TimeDiffToNowM =
    DATEDIFF ( CurrentCreatedon, TodayCurrentTime, MINUTE )
VAR TimeDiffToNowS =
    DATEDIFF ( CurrentCreatedon, TodayCurrentTime, SECOND )
VAR OutputOthers =
    TRUNC ( TimeDifferenceM / 60, 0 ) & " hrs "
        & MOD ( TimeDifferenceM, 60 ) & " min "
        & MOD ( TimeDifferenceS, 60 ) & " Secs"
VAR OutputFirst =
    TRUNC ( TimeDiffToNowM / 60, 0 ) & " hrs "
        & MOD ( TimeDiffToNowM, 60 ) & " min "
        & MOD ( TimeDiffToNowS, 60 ) & " Secs"
RETURN
    IF ( ISBLANK ( TimeDifferenceS ), OutputFirst, OutputOthers )

View solution in original post

4 REPLIES 4
ahmedoye
Responsive Resident
Responsive Resident

Try the below: (Just change references to "Table" to the original name of your table. If it works, kindly mark it as a solution so anyone who needs a similar solution in future can easily find it.

 

Column =
VAR CurrentCreatedon = 'Table'[createdon]
VAR CurrentName = 'Table'[Name]
VAR NextTime =
    MINX (
        TOPN (
            1,
            FILTER (
                'Table',
                'Table'[createdon] > CurrentCreatedon
                    && 'Table'[Name] = CurrentName
            ),
            'Table'[createdon], ASC
        ),
        'Table'[createdon]
    )
VAR TimeDifferenceM =
    DATEDIFF ( CurrentCreatedon, NextTime, MINUTE )
VAR TimeDifferenceS =
    DATEDIFF ( CurrentCreatedon, NextTime, SECOND )
VAR TodayCurrentTime =
    NOW ()
VAR TimeDiffToNowM =
    DATEDIFF ( CurrentCreatedon, TodayCurrentTime, MINUTE )
VAR TimeDiffToNowS =
    DATEDIFF ( CurrentCreatedon, TodayCurrentTime, SECOND )
VAR OutputOthers =
    TRUNC ( TimeDifferenceM / 60, 0 ) & " hrs "
        & MOD ( TimeDifferenceM, 60 ) & " min "
        & MOD ( TimeDifferenceS, 60 ) & " Secs"
VAR OutputFirst =
    TRUNC ( TimeDiffToNowM / 60, 0 ) & " hrs "
        & MOD ( TimeDiffToNowM, 60 ) & " min "
        & MOD ( TimeDiffToNowS, 60 ) & " Secs"
RETURN
    IF ( ISBLANK ( TimeDifferenceS ), OutputFirst, OutputOthers )

Thank so much, that was perfect from a text point of view. I then just added a further column to convert into decimals to create analysis on the back of this

Hi @RhodesBrown 

 

I'm getting a message "not enough to perform this operation" my VM configuration is 16 GB, is it sufficient?

RhodesBrown
Frequent Visitor

@amitchandak anything you can help with?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.