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
KeithKing
New Member

How to get date difference between last logon and last password reset dates in Active Directory

Hi Guys, I would like to get the date difference between Last Logon and Last Password Reset columns and the display a warning or text that the user hasn't reset their password in x amount of days.

 

This is what I am using now but does not display the correct information:

 

     Measure =
VAR Created =
MAX ( user[user.lastLogon].[Year])
VAR Closed =
MAX ( user[user.pwdLastSet].[Year] )
VAR NoOfDays =
IF (
Closed > Created,
DATEDIFF ( Created, Closed, YEAR),
DATEDIFF ( Closed, Created, YEAR)
)
RETURN
IF ( NoOfDays >= 1, "User account Fine", "Password Needs to be Reset )

5 REPLIES 5
az38
Community Champion
Community Champion

Hi @KeithKing 

try the same but without .[Year] in Created and Closed variables

That should be enough

 

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


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

Hi,

 

It sort of works now 🙂  but the problem is that I have an account CustomerCare1  with last logon at 2019/12/06 and last password reset at 2019/08/02.  This is a 4 month difference but it says the user account is fine? It needs to check the year as well as months (3 months after that password needs to be reset)

 

Hope I am making sense?

 

Thanks

az38
Community Champion
Community Champion

@KeithKing 

DATEDIFF ( Created, Closed, MONTH) will give you difference in monthes without any dependencies of Year

 

For example 

 

DATEDIFF ( DATE(2019,11,1), DATE(2020,1,11), MONTH) will return you 2 month difference

 

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


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

Thanks!! 

az38
Community Champion
Community Champion

@KeithKing 

does it work ok? 

 

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


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

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.

Top Solution Authors