Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sochoa
Contributor II
Contributor II

Expression Not Showing Dynamic Value

Good Afternoon! I am new to Qlikview and am having some issues with an expression calculation in my chart. I need to allow the calculation to be dynamic when different dates are selected. 

The purpose of the chart is to show the actual activity an employee has done side by side with the employees expected activity during a 40 hour work week. We show 40 hours for full time employees, 30 hours for part-time employees, and an average for the other categories. We also want to allow a percentage of time for new employee ramp up in the calculation. 

The issue that I'm currently having is that the chart seems to only be using the last condition in the entire statement. Can anyone please assist? I'm sure there is something in the syntax causing the issue. I have tried rewriting it several different ways but am still having issues with the chart showing the data with the conditional logic. 

=IF(WorkerCategory= 'CategoryA' and NewEmp=0 and IsEmployeeTypeA=0,sum(Hrs)/(GetSelectedCount(Date)/7)/40

,IF(WorkerCategory= 'CategoryA' and NewEmp=1 and IsEmployeeTypeA=0,40*(GetSelectedCount(Date)-DaysSinceProductive/(GetSelectedCount(Date)))
,IF(WorkerCategory= 'CategoryB' and NewEmp=0 and IsEmployeeTypeA=0,sum(Hrs)/(GetSelectedCount(Date)/7)/30
,IF(WorkerCategory= 'CategoryB' and NewEmp=1 and IsEmployeeTypeA=0,30*(GetSelectedCount(Date)/7)-DaysSinceProductive/(GetSelectedCount(Date)/7)
//should all be % of what they are ramping up to work
,IF(WorkerCategory= 'CategoryC'and IsEmployeeTypeA=0,sum(Hrs)/(GetSelectedCount(Date)/7)/avg(hrs)
,IF(WorkerCategory= 'CategoryD' and IsEmployeeTypeA=0,sum(Hrs)/(GetSelectedCount(Date)/7)/avg(hrs)
,sum(Hrs)/(GetSelectedCount(Date)/7)/25
))))))

 

1 Solution

Accepted Solutions
rubenmarin

Hi, maybe you are using a chart with a dimension that have more that one different value in the fields used.
In example, if you have month as dimension, and in this month 4 different WorkerCategory are present, which one is the WorkerCategory of the month? as this can't be answered with one value it will return Null() as WorkerCategory

In this case one option to split the conditions can be setting all expression inside an aggr that does the calculations for each of the field values:
Sum(Aggr(YourCurrentExpression, WorkerCategory, NewEmp, IsEmployeeTypeA))

View solution in original post

4 Replies
uacg0009
Partner - Specialist
Partner - Specialist

Hi Sochoa,
Do you mind uploading a sample of you qvw? maybe 10 columns data is fine,
so I can know what you get now and what you want in your qvw.
Thanks.
Aiolos
rubenmarin

Hi, maybe you are using a chart with a dimension that have more that one different value in the fields used.
In example, if you have month as dimension, and in this month 4 different WorkerCategory are present, which one is the WorkerCategory of the month? as this can't be answered with one value it will return Null() as WorkerCategory

In this case one option to split the conditions can be setting all expression inside an aggr that does the calculations for each of the field values:
Sum(Aggr(YourCurrentExpression, WorkerCategory, NewEmp, IsEmployeeTypeA))
sochoa
Contributor II
Contributor II
Author

Hi there! Thanks for your response. I was able to figure out the issue. The data behind the calculation was not showing correctly and breaking the formula. I will go ahead and close this post. 

sochoa
Contributor II
Contributor II
Author

Yes, this is exactly what is happening! Thank you for your response! The data behind the calculation needs to be aggregated differently before it will show up properly in the chart.