Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |