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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
bmurphy
Regular Visitor

As of Date or Current Date

Trying to get an As of Date or Current Date calendar search option to work on Active Employee or New Hires or Termed Employees type reports.  So for example,  whatever date is selected/chosen, ONLY those Active EE's on that selected date would appear.  If the date selected was 11/11/2024, only Employees who were active would be on the report....basing it off Latest Hire Date field.

Anyone with experience using this type of Date option?

 

Dates = calendar(min(EIS_EMPLOYEE_VW[Latest Hire Date]),max(EIS_EMPLOYEE_VW[TERMINATION_DATE]))
 
For Date Search box:   Date Search = Dates[Date]

  

Created an additional column under the Employee view:

Active EE Date Filter = VAR CurrentDate = SELECTEDVALUE('Dates'[Date])
VAR HireDate = SELECTEDVALUE('EIS_EMPLOYEE_VW'[Latest Hire Date])
VAR TermDate = SELECTEDVALUE('EIS_EMPLOYEE_VW'[TERMINATION_DATE])
 
RETURN
IF(HireDate <= CurrentDate && TermDate = BLANK() || TermDate >= CurrentDate , "Filter In" , "Filter Out")
 
It's just not pulling in right.  It's including Employees with hire dates AFTER the date in the calendar.
 
Any help is appreciated.
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @bmurphy 

 

Try this and ensure that the dates table is not related to your employees table

Active Employees = 
VAR _SelectedDate = 
    -- Get the latest selected date from the Dates table
    MAX ( Dates[Date] ) 

RETURN
    CALCULATE (
        -- Count the number of employees
        COUNTROWS ( 'Employee' ),
        
        -- Filter for employees who have been hired on or before the selected date
        'Employee'[HireDate] <= _SelectedDate,
        
        -- Include employees who either:
        OR (
            -- Have no termination date (still active)
            ISBLANK ( 'Employee'[TerminationDate] ),
            
            -- Or, have a termination date in the future (still employed)
            'Employee'[TerminationDate] > _SelectedDate
        )
    )

danextian_0-1744865831937.png

Sample pbix attached.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

10 REPLIES 10
danextian
Super User
Super User

Hi @bmurphy 

 

Try this and ensure that the dates table is not related to your employees table

Active Employees = 
VAR _SelectedDate = 
    -- Get the latest selected date from the Dates table
    MAX ( Dates[Date] ) 

RETURN
    CALCULATE (
        -- Count the number of employees
        COUNTROWS ( 'Employee' ),
        
        -- Filter for employees who have been hired on or before the selected date
        'Employee'[HireDate] <= _SelectedDate,
        
        -- Include employees who either:
        OR (
            -- Have no termination date (still active)
            ISBLANK ( 'Employee'[TerminationDate] ),
            
            -- Or, have a termination date in the future (still employed)
            'Employee'[TerminationDate] > _SelectedDate
        )
    )

danextian_0-1744865831937.png

Sample pbix attached.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

I think this actually is working!  OMG.  Thank you!  Power BI is all new to me and so different than our reporting system I'm leaving, so I have so much to learn!   I'm sure many questions ahead!  I do have a question tho....how come you don't need to join it to the Employee table?  Because of what's included in the measure itself?

If you do, your data gets filtered to either the hire or termination date depending  on  which column the relationshiop is on.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
ryan_mayu
Super User
Super User

Do you mean active on the selected day or active now? could you pls provide some sample data and the expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for responding/asking.  It's active on the selected day.  If I put in 10/31/24, I want to know who was active on that day.  If I put in 07/12/2021, I want to see who was active on THAT day.

bmurphy
Regular Visitor

I really appreciate this and I'll take a look!

Hi @bmurphy 

Have you verified the files shared by @amitchandak and @danextian ? Could you please let me know if they resolve your issue? If you have identified a solution, we kindly request you to share it with the community, as it may be helpful to others facing a similar issue.

If you find the response helpful, please mark it as the accepted solution and provide kudos, as this will assist other members with similar queries.

Thank You!

I apologize for the delay.  We are a LARGE company and I needed to do some validations amongst many other day to day tasks. 🙂

amitchandak
Super User
Super User

@bmurphy , Please refer to the attached files. You can also check

 

Power BI: HR Analytics - Employees as on Date: https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you so much for an actual example I can try and work off of.  I appreciate it.  Will do some validations and see if this will work!  Thank you!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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