March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have two tables that I've joined together. One contains user sessions of a database (sessionid, userid, logintime etc).
The other contains sql commands made in each sessions and so is more granular (sessionid, sqlcommandid, sqlcommandtime etc).
I've joined them on sessionid.
I want to find the difference in time between the first session time and the first sql command time by user.
I've figured out how to get the first session time:
First Session Date =
CALCULATE (
MIN ( SESSIONS[LOGINTIME] ),
ALLEXCEPT ( SESSIONS, SESSIONS[USERid] )
)
What I'm struggling with is getting the first sqlcommand time for each user. The problem is the sql command time and the user id are in different tables, albeit joined ones.
I've tried merging the tables to get around this but it keeps failing so I'm looking for a dax solution.
Bit of a tricky one I know! But any pointers would be most appreciated.
Solved! Go to Solution.
Hi @Anonymous ,
In case you didn't want to increase the size of your model by adding extra columns, you still could get your Average with a measure leveraging the relationship between the two tables.
Hi @Anonymous ,
Is this what you are looking for?
First Login time by user =
MIN(UserSessions[Logintime])
First SQL command time by user =
MIN(SQLCommands[sqlcommandtime])
Sort of, though I needed it as a measure so that I can display the average difference between the two times (average by user). The above works but only as a table. I've found a fairly complex solution.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
22 | |
19 | |
17 | |
9 | |
5 |
User | Count |
---|---|
37 | |
29 | |
16 | |
14 | |
12 |