3 Replies Latest reply: Dec 5, 2016 2:13 AM by Gysbert Wassenaar RSS

    Qlik Sense variables

    mark brouwer

      Hi,

       

      I am new to QS and am currently struggling with variables.

       

      I have two tables (INVOICED and NEWORDERS) which are not related in any way.

       

      I declare a variable using the INVOICED table where I want to track the latest date: 

       

                Let vInvoicedmonth = '=max(Invoiced.date)';

       

      I then want to use this variable in the NEWORDERS table where I want to selected the new orders which fall in the same month as the Invoiced data:

       

                sum(if(inmonth([NewOrd.Date], '$(vInvoicedmonth)',0) = -1, [NewOrd.Margin]))

       

      This doesn't work.  I suspect it is because the tables are unrelated.  Is there a way of creating a global variable (non-static) that can be used across all tables, regardless of relationship?