Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

Set analysis expression based on variable value

Hi

I'm using QlikView Components to generate a master calendar table and set analysis variables. This allows me to easily create expressions for the current year to date and comparisons to the previous year. For example:

Total amount in year to date: Sum($(vSetYTD) Amount)

Total amount in the previous year to date: Sum($(vSetPreviousYearYTD) Amount)

My next goal is to provide the ability to select the period used in the set analysis.

To do this I have created three text area objects, which set a variable vSetPeriodSelection to 'YTD', 'MTD', and 'QTD' respectively.

I've tried expressions such as Sum($(IF(vSetPeriodSelection = 'YTD', vSetYTD, IF(vSetPeriodSelection = 'QTD', vSetQTD, vSetMTD))) Amount) without any success.

So my question is how do I use the value of this variable to determine the variable used in the set expression?

thanks