Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Re: Employees who only take leave on Monday & Friday

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!

4 Replies
tresesco
Not applicable

Re: Employees who only take leave on Monday & Friday

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
Not applicable

Re: Employees who only take leave on Monday & Friday

Hi,

Try this as well.

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

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

pratap6699
Not applicable

Re: Employees who only take leave on Monday & Friday

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

Not applicable

Re: Employees who only take leave on Monday & Friday

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!