4 Replies Latest reply: Jan 24, 2017 3:04 PM by Stefan Wühl RSS

    Using a variable in set analysis in Qlik Sense

    Christopher Hayes

      I am trying to use a variable in a set analysis expression. The variable is being set in my script:


                LET v_prior_year = Year(MonthStart(Today(1)) - 1) - 1;


      And the set analysis expression I am trying to get to work:


                Sum({$<[Invoice Year]={$(=v_previous_year)}>}[Ship Amount]) / Sum({$<[Invoice Year]={$(=v_previous_year)}>}[Ship Quantity])


      I've tried different variations based on what I've read here, but none of them seem to work. I am using Qlik Sense 3.1. Any help is appreciated.