Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Employees who only take leave on Monday & Friday

Hi I am trying to find a way to create a chart that will show Data for employees who take sick leave exclusively on Mondays and Fridays.  (Eventually, I am looking to include each side of Holidays as well).  Originally, I was using the experession

=if(WeekDay(leave)=0 or WeekDay(leave)=4, sum({<[Leave Type]={'Sick Leave'}>}pay_hours), null())

However, this returns the results for people who have leave on those days but may have leave on the other days as well.

Any help you can give would be appreciated!

1 Solution

Accepted Solutions
Not applicable
Author

I actually solved this by using:

if(sum({1<[Leave Type]={'Sick Leave'},[Leave day]={"Monday","Friday"}>} pay_hours) - sum({1<[Leave Type]={'Sick Leave'}>} pay_hours)=0,sum({1<[Leave Type]={'Sick Leave'}>} pay_hours) , null())

This basically says if you subtract the Total Leave Hours from the Total Leave Hours for Mon\Friday are they the same?  If so, present just those employees.  (My dimension is the employee if it wasn't obvious in the description).

Thanks to everyone for giving it a crack!

View solution in original post

4 Replies
tresesco
MVP
MVP

May be something like:

sum( {$<[Leave Type]={'Sick Leave'}, people= E({1<leave={"=Match(WeekDay(leave),1,2,3,5,6)"}>}people)>} pay_hours)

people field has to be modified (possibly to 'Employee') according to your case. If this doesn't give you what you need, try to share a sample qvw explaining the expected output there.

settu_periasamy
Master III
Master III

Hi,

Try this as well.

=if(num(WeekDay(leave))=0 or

     num(WeekDay(leave))=4, sum({<[Leave Type]={'Sick Leave'}>}pay_hours), null())

pratap6699
Creator
Creator

sum( {$<[Leave Type]={'Sick Leave'},[Leave day]={'Mon,Fri'}>}people)>} pay_hours)

Not applicable
Author

I actually solved this by using:

if(sum({1<[Leave Type]={'Sick Leave'},[Leave day]={"Monday","Friday"}>} pay_hours) - sum({1<[Leave Type]={'Sick Leave'}>} pay_hours)=0,sum({1<[Leave Type]={'Sick Leave'}>} pay_hours) , null())

This basically says if you subtract the Total Leave Hours from the Total Leave Hours for Mon\Friday are they the same?  If so, present just those employees.  (My dimension is the employee if it wasn't obvious in the description).

Thanks to everyone for giving it a crack!