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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
athomp15
Helper I
Helper I

DAX Time compare (same column next row)

Hi All, I've solved this issue in Power Query, but would prefer a DAX solution. I've tried a EARLIER function, but can't quite get the results I need. Anyhow I have a table that looks like the following.  What I would like to do is to calculate the time difference between each page access.

 

userpage urldate/time accessed
joepage 112/11/2019 10:00:01
fredpage 112/11/2019 10:00:01
joepage 312/11/2019 10:00:04
joepage 412/11/2019 10:00:05
fredpage 512/11/2019 10:00:07
fredpage 612/11/2019 10:00:08
fredpage 712/11/2019 10:00:21
joepage 812/11/2019 10:00:22
fredpage 912/11/2019 10:00:22
joepage 1012/11/2019 10:00:30

 

So when in a Table visual I get something along the lines of

 

userpage urldate/time accessedTime on page (s)
joepage 112/11/2019 10:00:013
joepage 312/11/2019 10:00:041
joepage 412/11/2019 10:00:051
joepage 812/11/2019 10:00:2217
joepage 1012/11/2019 10:00:30 

 

Any help would be greatly appreciated.

Thanks

Alex

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @athomp15 

 

Is the below Measure any help?

Measure = 
VAR mdt = MAX(YourTable[date/time accessed])
RETURN 
DATEDIFF(
    mdt,
    CALCULATE(
        MIN(YourTable[date/time accessed]),
        ALLEXCEPT(YourTable, YourTable[user]),
        YourTable[date/time accessed] > mdt
    ),
    SECOND
)


Hope this helps

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.