Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Analysis with Variable

Hi

I have created a variable to determine the previous month (PreviousMonth). 

I can create a chart using the variable, but I want to do this as set analysis in the chart. 

Please can anyone help me with the code.  My current expression is :

If(

MonthName(Date(Month_Yr))=MonthName(Date(PreviousMonth-1)),

  (Sum({<Sick_Type={'STS'}>} ((Absence_FTE)))/Sum({<Sick_Type={'STS'}>} ((Avail_FTE))))+

  (Sum({<Sick_Type={'LTS'}>} ((Absence_FTE)))/Sum({<Sick_Type={'LTS'}>} ((Avail_FTE))))

)

Any help appreciated?

Regards

Phil

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

you can't use expressions in set analysis in the left side of the equation

so if you want to use monthname you'll need to create a field with this data in your script

but maybe this will work

  (Sum({<Sick_Type={'STS'},Month_Yr={"$(=(PreviousMonth)-1)"}>} ((Absence_FTE)))/Sum({<Sick_Type={'STS'},Month_Yr={"$(=(PreviousMonth)-1)>} ((Avail_FTE))))+

  (Sum({<Sick_Type={'LTS'},Month_Yr={"$(=(PreviousMonth)-1)>} ((Absence_FTE)))/Sum({<Sick_Type={'LTS'},Month_Yr={"$(=(PreviousMonth)-1)>} ((Avail_FTE))))

Anonymous
Not applicable
Author

A couple of typo's, but it still didn't work.  Tried ....

  (Sum({<Sick_Type={'STS'},Month_Yr={'$(=(PreviousMonth)-1)'}>} ((Absence_FTE)))/Sum({<Sick_Type={'STS'},Month_Yr={'$(=(PreviousMonth)-1)'>} ((Avail_FTE))))

  +

  (Sum({<Sick_Type={'LTS'},Month_Yr={'$(=(PreviousMonth)-1)'}>} ((Absence_FTE)))/Sum({<Sick_Type={'LTS'},Month_Yr={'$(=(PreviousMonth)-1)'>} ((Avail_FTE))))