8 Replies Latest reply: Feb 18, 2016 2:18 AM by Tresesco B RSS

    Variable within an expression

    Swetha More

      Hi there,

       

      I am trying to display the comparison of sales revenue from the current month and the previous month. I am using the below expressions :

       

      Previous Month ----- sum({$<vInvoicedate={$(=monthname(addmonths(Today()),-1)))}>}$(=Inv_Ref))

      Current Month ------- sum({<vInvoicedate={$(=(max(vInvoicedate)))}>}$(=Inv_Ref))

       

      The Above Expressions don't work. But if I replace $(=Inv_Ref) to a field like ----- sum({$<vInvoicedate{$(=monthname(addmonths(Today()),-1)))}>}amount_total) this works just fine but i cant use a field name there because sale revenue calculation is stored in a variable and that variable is Inv_Ref. The calculation of this variable is like this Inv_Ref =  $(Inv_total) - $(Ref_Total).

       

      Could someone help me in correcting this expression?

       

      Appreciate all your help.

       

       

      Note: I am a total beginner and novice in Qlik Sense.

       

       

      Thanks very much

      Swetha