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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anil59060
Frequent Visitor

Absent / Present based on date range

I have 10 employees in my Dept. Each one submits his leave plan begining of a year which includes Emp No, Leave Start and Leave end dates (Emp Table). I want to see on a selected date if a particular employee is available or not using calculated column as given below;

 

Emp 1 =
VAR _Check= SELECTEDVALUE(Emp No)
VAR _max = SELECTEDVALUE('Date'[Date])
VAR _min = SELECTEDVALUE('Date'[Date])
RETURN
    IF (_Check= "Emp 1" && _min>=SELECTEDVALUE(Emp[Leave Start]) && _max<=SELECTEDVALUE(Emp[Leave End]),"Leave","Available")

 

I am getting "Available" on all dates. Let me know what is wrong in above !

1 REPLY 1
stevedep
Memorable Member
Memorable Member

Hi,

 

Below works;

 

__Available = 
var _selDate = SELECTEDVALUE('Date'[Date])
return
if (
COUNTROWS(FILTER('Emp Table', 'Emp Table'[Leave Start] >= _selDate && _selDate <= 'Emp Table'[Leave End] )) > 0 , "Not Available", "Available")

 

As seen here:

empavail.jpgmodel.jpg

Please note the data model and the helper columns to join, value is 1 in both. 

 

The file

 

Please mark as solution if so. Thumps up for the effort is appreciated.

 

Kind regards, 

 

 

Steve. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.