Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Qlik Sense variables


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?  

3 Replies
Valued Contributor II

Re: Qlik Sense variables

Can you share the Sample qvf file ?

Valued Contributor II

Re: Qlik Sense variables

May be try this , sum(if(match(Month([NewOrd.Date]),Month($(vInvoicedmonth))), [NewOrd.Margin]))

Re: Qlik Sense variables

Try removing the single quotes around the variable dollar expansion in the expression:

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

talk is cheap, supply exceeds demand
Community Browser