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

Less Than or equal in expression

Dear Friends,

I have created following  variable  in Qv document

let  vTdate=num(Date(MakeDate(2019,10,31),'YYYY/MM/DD'));

and I have written following expression in my pivot table and it works perfectly

SUM({<FYYYYMM={$(=vTmonth)},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

but when I try   to change the expression as shown below it does not work

SUM({<FYYYYMM={"<=$(vTmonth)"},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

I want to change the equal to less than or equal. Pls help me to correct the expression

 

1 Solution

Accepted Solutions
asinha1991
Creator III
Creator III

this is the problem

text(DATE(POL_PERIOD_FROM,'YYYYMM'))AS FYYYYMM

creates text, text cannot be evaluated using  > or <, hence it worked with only =

first expression should work in my opinion if you make FYYYYMM as num

something like this

num#(text(DATE(POL_PERIOD_FROM,'YYYYMM'))) AS FYYYYMM

View solution in original post

9 Replies
asinha1991
Creator III
Creator III

maybe try this

 

SUM({<FYYYYMM={"<=$(=vTmonth)"},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

upaliwije
Creator II
Creator II
Author

Thanks for your reply,

But it does not work

 

upaliwije
Creator II
Creator II
Author

Very Sorry

I have missed to mention My expression for vTmonth . It is as follows

LET vFmonth=Date($(vFdate),'YYYYMM')

asinha1991
Creator III
Creator III

check if this works.

SUM({<FYYYYMM={"<='$(vTmonth)'"},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

 

if not can you check at bottom pane of expression dialog and let me know what this expression is evaluated to?

upaliwije
Creator II
Creator II
Author

Dear Asinha

It is still not working and expression evaluation is like below

clipboard_image_0.png

asinha1991
Creator III
Creator III

is FYYYYMM a date field? or a number field?

can you see what is evaluates to?

SUM({<FYYYYMM={"<=$(vTmonth)"},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

 

also try 

SUM({<FYYYYMM={"<=num#('$(vTmonth)')"},POL_TYPE={'R','A'},HISTORY={'Y'}>}PREMIUM)

upaliwije
Creator II
Creator II
Author

 

Both Expression does not work

 FYYYYMM is created in my master calendar with the syntax

text(DATE(POL_PERIOD_FROM,'YYYYMM'))AS FYYYYMM

 

Evaluation for 1st Expression

clipboard_image_0.png

Evaluation for 2nd Expression

clipboard_image_1.png

asinha1991
Creator III
Creator III

this is the problem

text(DATE(POL_PERIOD_FROM,'YYYYMM'))AS FYYYYMM

creates text, text cannot be evaluated using  > or <, hence it worked with only =

first expression should work in my opinion if you make FYYYYMM as num

something like this

num#(text(DATE(POL_PERIOD_FROM,'YYYYMM'))) AS FYYYYMM

upaliwije
Creator II
Creator II
Author

Thanks

It is working. I was not aware that text fields does not work with <> signs. I learned it from you. Thanks you very much. The other this I am not very familiar with these date functions. Can u pls recommend some documents to read.