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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Show data if end date is not reached

Hi guys,

 

I want to see which employees were working in my company during a filtered time period.

I tried using these measures:

    SelectedDate = 'Date'[Date]

    Active = IF(SelectedDate > MIN('Employee'[StartDate] && SelectedDate < 'Employee'[EndDate]; "y"; "n")

But this will always give "y" as a response

 

Let's say we'd look at 01-02-2020 then I'd want the Active- column to display the following:

 

EmployeeStartDateEndDateActive?
employee a1-1-2020 y
employee b1-1-201631-06-2018n
employee c1-4-2018 y
employee d1-12-2015 y
employee e1-1-201831-12-2018n
employee f1-7-201731-12-2019n
employee g1-1-2019 y
1 ACCEPTED SOLUTION

Hi @Anonymous,

 

you can create a measure, replace Dates[Date] with your slicer Dates Table.

Active = 
SWITCH(
    TRUE();
    Max('Table'[EndDate]) = BLANK(); "Y";
    MAX(Dates[Date]) < MAX( 'Table'[EndDate]); "Y"; "N"
    )

 -------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

First you need to create a CALENDAR table and use date field as silcer.

CALENDAR = CALENDARAUTO()

Please refer to the measure below.

active = 
var startdate = SELECTEDVALUE('Table'[StartDate])
var enddate = SELECTEDVALUE('Table'[EndDate])
var mindate = MIN('CALENDAR'[Date])
var maxdate = MAX('CALENDAR'[Date])
return
IF((enddate<>BLANK()&&enddate<mindate)||startdate>maxdate,"n","y")

Result would be shown as below.

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

rainer1
Resolver III
Resolver III

Hi @Anonymous,

 

you can try these Dax Code in a new calculated Column. This should work for you.

Active = 
var selectedDate = DATE(2020;02;01)

return
IF('Table'[EndDate] = BLANK() || 'Table'[EndDate] > selectedDate; "Y"; "N")

 

The output look like this.

Anmerkung 2020-02-27 145447.png

 

Regards

 

-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

Anonymous
Not applicable

Hi @rainer1 ,

 

This works perfectly if I have one specific date, but I would like to be able to see this information for dates a user can pick.

Do you know how to solve this issue?

 

Kind regards

Hi @Anonymous,

 

you can create a measure, replace Dates[Date] with your slicer Dates Table.

Active = 
SWITCH(
    TRUE();
    Max('Table'[EndDate]) = BLANK(); "Y";
    MAX(Dates[Date]) < MAX( 'Table'[EndDate]); "Y"; "N"
    )

 -------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

Refer My HR Blog: https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

You can have an employee of every month or day

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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