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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Get previous Timestamp of User

I need to add a calculated column with the user's previous visit. The rows are not necessarily sorted by any order.

 

UserCurrent TSPrevious TS
Bill14th March 2019, 20:45:000
Aaron28th May 2019, 12:00:000
Aaron30th August 2019, 07:43:00 28th May 2019, 12:00:00
John15th September 2019, 09:00:000
Bill20th December 2019, 04:34:0014th March 2019, 20:45:00
1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure =
VAR LastTS =
    CALCULATE (
        MAX ( 'Table'[Current TS] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[User] IN FILTERS ( 'Table'[User] )
                && 'Table'[Current TS] < MAX ( 'Table'[Current TS] )
        )
    )
RETURN
    IF ( LastTS <> BLANK (), FORMAT ( LastTS, "YYYY-MM-DD HH:MM:SS" ), 0 )

The result shows:

21.PNG

 

Best Regards,

Giotto

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure =
VAR LastTS =
    CALCULATE (
        MAX ( 'Table'[Current TS] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[User] IN FILTERS ( 'Table'[User] )
                && 'Table'[Current TS] < MAX ( 'Table'[Current TS] )
        )
    )
RETURN
    IF ( LastTS <> BLANK (), FORMAT ( LastTS, "YYYY-MM-DD HH:MM:SS" ), 0 )

The result shows:

21.PNG

 

Best Regards,

Giotto

az38
Community Champion
Community Champion

Hi @Anonymous 

try column

Previous TS =
var _curDate = Table[Current TS]
RETURN
CALCULATE( MAX(Table[Current TS]), ALLEXCEPT(Table, Table[User]), Table[Current TS] < _curDate)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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