Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

issue with use of SetAnalysis to variables for previous year and month

Hi,

i am trying to get count of previous year and previous month using setanalysis to variables, where it gives me zero, even though i have value for it.

in front end

count({<client_id={'15'},DateType = {'invitation'},Month_Num = {"$(=num(Month(AddMonths(today(),-1)),'00'))"},Year = {"$(=year(max(CanonicalDate))-1)"} >}invitation_id)

results in 2334

In script with setanalysis and variables:

what i tried:

let var3 = 'count({<client_id={''13''},DateType = {''invitation''},Month_Num = {"$' &'(=num(Month(AddMonths(today(),-1)),'00'))"},Year = {"$' &'(=year(max(CanonicalDate))-1)"} >}invitation_id)';  // this gives error


let var1 = 'count({<client_id={''13''},DateType = {''accessed''},Month_Num = {"$' &'(=num(Month(AddMonths(today(),-1))))"},Year = {"$' &'(=year(max(CanonicalDate))-1)"} >}invitation_id)';

let var2 = 'count({<client_id={''13''},DateType = {''accessed''},Month_Num = {"$' &'($' &'(=num(Month(AddMonths(today(),-1)))))},Year = {"$' &'($' &'(=year(max(CanonicalDate))-1))"} >}invitation_id)';

all this gives me zero in front end.

$(var1) results zero

$(var2) results zero


What i am missing here? Please help me on this.

7 Replies
Highlighted
Champion III
Champion III

try this

($(var1)

or

('$(var1)'

or

'$(var1)'

Highlighted
Creator II
Creator II

Hi Chanty,

All gives me empty

Highlighted
Champion III
Champion III

try to remove single quotes in  expression   and try once.

let var3 = count({<client_id={''13''},DateType = {''invitation''},Month_Num = {"$' &'(=num(Month(AddMonths(today(),-1)),'00'))"},Year = {"$' &'(=year(max(CanonicalDate))-1)"} >}invitation_id); // this gives error


let var1 = count({<client_id={''13''},DateType = {''accessed''},Month_Num = {"$' &'(=num(Month(AddMonths(today(),-1))))"},Year = {"$' &'(=year(max(CanonicalDate))-1)"} >}invitation_id);

let var2 =count({<client_id={''13''},DateType = {''accessed''},Month_Num = {"$' &'($' &'(=num(Month(AddMonths(today(),-1)))))},Year = {"$' &'($' &'(=year(max(CanonicalDate))-1))"} >}invitation_id);

Highlighted
Creator II
Creator II

This gives me Unknown Error. I am not able to load script.

Highlighted
Creator III
Creator III

try this

$(=var1) or  simply var1

Highlighted
Partner
Partner

Try Set instead of Let

Highlighted
Partner
Partner

Hi Supriya,

Try this

var1 (without any $ ())