Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
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
Chanty4u
MVP
MVP

try this

($(var1)

or

('$(var1)'

or

'$(var1)'

berryandcherry6
Creator II
Creator II
Author

Hi Chanty,

All gives me empty

Chanty4u
MVP
MVP

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);

berryandcherry6
Creator II
Creator II
Author

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

hemanthaanichet
Creator III
Creator III

try this

$(=var1) or  simply var1

shraddha_g
Partner - Master III
Partner - Master III

Try Set instead of Let

dineshraj
Partner - Creator
Partner - Creator

Hi Supriya,

Try this

var1 (without any $ ())