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

business rule using a loop?

Hi Guys,

I struggling to create a loop to translate a specific business rule.

I need to create a rule in Qlikview that loops trough the the dates that an employee called sick.

If the last sickness date of that employee  is smaller than 28 days,  then the duration of the last sickness day,

should be accumulated with the duration of the last sickness duration.

If the sickness between the previous sickness date is longer than 28 days, then the duration of the last sickness is being used.

I really hope the above is clear. My apologize for my English.

To clarify the above, please look excel file. and the QV file.

Please let me know if you have any questions or if the above is not clear.

Cheers.

Sam

1 Solution

Accepted Solutions
Not applicable
Author

Hi Sam,

As I checked your data, it contained duplicate rows.

I reapplied same script using "distinct" and it seems to give logical results.

You can check the attached app for the results and compare later when you reload (note that i'm reading your temp.qvw as binary in the beginning of the script).

View solution in original post

4 Replies
Not applicable
Author

Hello Sam,

You can find attached an app that hopefully answers your request.

Cheers !

Anonymous
Not applicable
Author

Hi Jean-Pierre,

Sorry for the late response.

Thanks for your help! Unfortunately this works on 1 employee. When I apply your script to my table I get strange results.

Have a look at employeeID= 5240. This person called sick 10 times, often within the 28 days limitation. However looking at the field 'cumulativedurationstart' I don't get the disired results.

Thanks in advance!

Sam

Not applicable
Author

Hi Sam,

As I checked your data, it contained duplicate rows.

I reapplied same script using "distinct" and it seems to give logical results.

You can check the attached app for the results and compare later when you reload (note that i'm reading your temp.qvw as binary in the beginning of the script).

Anonymous
Not applicable
Author

Hi Jean-Pierre,

Thanks for your help

That did the job!!

cheers!

Sam