Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlik Sense variables

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?  

3 Replies
lakshmikandh
Specialist II
Specialist II

Can you share the Sample qvf file ?

lakshmikandh
Specialist II
Specialist II

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

Gysbert_Wassenaar

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