Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I need to add a calculated column with the user's previous visit. The rows are not necessarily sorted by any order.
| User | Current TS | Previous TS |
| Bill | 14th March 2019, 20:45:00 | 0 |
| Aaron | 28th May 2019, 12:00:00 | 0 |
| Aaron | 30th August 2019, 07:43:00 | 28th May 2019, 12:00:00 |
| John | 15th September 2019, 09:00:00 | 0 |
| Bill | 20th December 2019, 04:34:00 | 14th March 2019, 20:45:00 |
Solved! Go to Solution.
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:
Best Regards,
Giotto
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:
Best Regards,
Giotto
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)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!