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
Anonymous
Not applicable

Active Directory user.lastLogon

Hello,

 

I am trying to convert the active directory user.lastlogon and user.lastlogontimestamp to readable date and times.    The command below which I found on the Internet does not appear to be working for me.

 

Help!

 

Last Logon = IF(AD_user[user.lastlogon]>0, (AD_user[user.lastlogon]/8.64*10^11)-109205, DATE(2000,01,01))

1 ACCEPTED SOLUTION
handrade
Frequent Visitor

Try the following code:

 

Last Logon = IF( AD_user[user.lastLogonTimestamp] > 0, AD_user[user.lastLogonTimestamp] / 864000000000 - 109205, DATE(2000,1,1) )

 

Make sure you assign the correct data type and that the default summarization is set to don't summarize. You can select the desired format.

AD_timespan.PNG

 

 

View solution in original post

2 REPLIES 2
handrade
Frequent Visitor

Try the following code:

 

Last Logon = IF( AD_user[user.lastLogonTimestamp] > 0, AD_user[user.lastLogonTimestamp] / 864000000000 - 109205, DATE(2000,1,1) )

 

Make sure you assign the correct data type and that the default summarization is set to don't summarize. You can select the desired format.

AD_timespan.PNG

 

 

Anonymous
Not applicable

Thank you!!  That did the trick.  

 

A tip for users, I set the last argument to 9999/01/01 to flag that there is no real last logon data available.

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.