2 Replies Latest reply: Nov 6, 2015 9:22 AM by Phil Speight

# 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

• ###### Re: Set Analysis with Variable

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))))

• ###### Re: Set Analysis with Variable

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))))