Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
faith04
Contributor II
Contributor II

Conditional statements

Hey Everyone

I would really appreciate your help on this one.

What would be an equivalent statement in qlik for the below statement?

for resource type in month:
    if resource type = Permanent or resource type = Contractor:
    avail_hours = avail_hours/ (8*5*4)

    else:
        avail_hours = avail_hours/ (7*5*4)

So I want to differentiate how I calculate the avail_hours  for these different groups

I've tried using the if statement on the script editor but I don't think it works or it doesn't calculate for each month

Is there a better way of doing it?

Labels (2)
1 Solution

Accepted Solutions
justISO
Specialist
Specialist

Hi, it depends on your data structure (data sample you are using now would be really helpful here, current load script too), but expression could be this:

if(match([resource type], 'Permanent', 'Contractor'), avail_hours / (8*5*4), avail_hours/ (7*5*4))

but to aggregate it by month, as I believe you are trying to achieve, you need write additional "group by [month].." at the end of your data load script.

View solution in original post

2 Replies
justISO
Specialist
Specialist

Hi, it depends on your data structure (data sample you are using now would be really helpful here, current load script too), but expression could be this:

if(match([resource type], 'Permanent', 'Contractor'), avail_hours / (8*5*4), avail_hours/ (7*5*4))

but to aggregate it by month, as I believe you are trying to achieve, you need write additional "group by [month].." at the end of your data load script.

faith04
Contributor II
Contributor II
Author

Thank you.

I will try this solution