Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PoshandBI
Regular Visitor

Date slicer for ADLastLogon

I have a table of all ADComputer Objects
Columns include PCName,ADLastLogonDate,ADStatus,ReportDate

The ADStatus could be Active, Disable, Delete depending on ADLastLogonDate

I would like a chart to show how many devices I will be disabling for the next 10 days starting tomorrow.  From my own reading I my need to create a second table with CALENDAR(NOW()-59,NOW()-50) to get the value of dates but I'm not sure where the next step is.  When I try to link the two tables together I get errors.

Thanks


2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @PoshandBI ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1676516192067.png

(2)We can create a table.

CALENDAR = CALENDAR(TODAY()+1,TODAY()+11)

vtangjiemsft_1-1676516281873.png

 

(3) We can create two measures. 

Disable devices = CALCULATE(COUNTROWS(FILTER(ALL('Table'),'Table'[ADStatus]="Disable" && 'Table'[ADLastLogonDate]>=TODAY()+1 && 'Table'[ADLastLogonDate]<=TODAY()+11)))
Measure 2 = CALCULATE(COUNTROWS(FILTER('Table','Table'[ADStatus]="Disable" && 'Table'[ADLastLogonDate]>=MIN('CALENDAR'[Date]) && 'Table'[ADLastLogonDate]<=MAX('CALENDAR'[Date]))))

(4) Then the result is as follows.

vtangjiemsft_2-1676516404815.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

PoshandBI
Regular Visitor

Hi.  This solution is close but it doesn't appear to account for the dates that are 60 days in past 🙂  Here is how the solution I came up with After I Impoted my data, I created a new column named WithinDates - the formula within it

WithinDates =
var DateRange = DATEDIFF('Data ActiveDirectoryLog'[AdLastLogonDate],now(),DAY)
return DateRange


This gives me a new filter on the visual to do less than or eq to 59 and greater than or equal to 50

Apologies for the delay

View solution in original post

2 REPLIES 2
PoshandBI
Regular Visitor

Hi.  This solution is close but it doesn't appear to account for the dates that are 60 days in past 🙂  Here is how the solution I came up with After I Impoted my data, I created a new column named WithinDates - the formula within it

WithinDates =
var DateRange = DATEDIFF('Data ActiveDirectoryLog'[AdLastLogonDate],now(),DAY)
return DateRange


This gives me a new filter on the visual to do less than or eq to 59 and greater than or equal to 50

Apologies for the delay

Anonymous
Not applicable

Hi @PoshandBI ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1676516192067.png

(2)We can create a table.

CALENDAR = CALENDAR(TODAY()+1,TODAY()+11)

vtangjiemsft_1-1676516281873.png

 

(3) We can create two measures. 

Disable devices = CALCULATE(COUNTROWS(FILTER(ALL('Table'),'Table'[ADStatus]="Disable" && 'Table'[ADLastLogonDate]>=TODAY()+1 && 'Table'[ADLastLogonDate]<=TODAY()+11)))
Measure 2 = CALCULATE(COUNTROWS(FILTER('Table','Table'[ADStatus]="Disable" && 'Table'[ADLastLogonDate]>=MIN('CALENDAR'[Date]) && 'Table'[ADLastLogonDate]<=MAX('CALENDAR'[Date]))))

(4) Then the result is as follows.

vtangjiemsft_2-1676516404815.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.