0 Replies Latest reply: Mar 30, 2015 2:00 AM by Ian Perrin RSS

    Set analysis expression based on variable value



      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?