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

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
v-jayw-msft
Community Support
Community Support

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.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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!

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.