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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors