Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

Lesser than clause for variable, not working

Hi Experts,

A variable "CuurentYear" is declared as: Max(Right(FiscalYear,4)) -1 & '-' & Max(Right(FiscalYear,4))

Works Fine:          Sum({<DOBStatus = {'C'},FiscalYear = {'$(=$(CurrentYear))'}>}DOBQty)

then I tried to use < sign in below clause it just stop working:

Does Not Work:      Sum({<DOBStatus = {'C'},FiscalYear <= {'$(=$(CurrentYear))'}>}DOBQty)

Can somebody please help,

Thanks & Regards,

6 Replies
rahulpawarb
Valued Contributor III

Re: Lesser than clause for variable, not working

Hello Shazad,

Please use below code:

Sum({<DOBStatus = {'C'}, FiscalYear = {"<=$(=$(CurrentYear))"}>}DOBQty)

Hope this will help.

Regards!
Rahul

Not applicable

Re: Lesser than clause for variable, not working

Hi Rahul, I have tried it. it doesn't help.

MVP
MVP

Re: Lesser than clause for variable, not working

What does the FiscalYear? It is a field isn't it? Is it dates in it? If so how are they formatted?

I don't quite understand what you are trying to achieve with the CurrentYear expression... This will always evaluate to -1 and nothing else...

vinieme12
Esteemed Contributor II

Re: Lesser than clause for variable, not working

Try below, depends on how your variable is defined

Sum({<DOBStatus = {'C'},FiscalYear = {"<$(CurrentYear)"}>}DOBQty)


or


Sum({<DOBStatus = {'C'},FiscalYear = {"<$(=CurrentYear)"}>}DOBQty)

Re: Lesser than clause for variable, not working

A variable "CuurentYear" is declared as: Max(Right(FiscalYear,4)) -1 & '-' & Max(Right(FiscalYear,4))

This is not going to work because your variable is essential a text and seems like Fiscal Year might be a text field also. May be you need another non-text field from your calendar object to do this kind of set analysis because you cannot do <, <=, >=, > on text fields and you need numeric fields for that.

May be look at this blog: Fiscal and Standard Calendar generation‌ and create another FiscalYear like this

YearName(Date, 0, $(vFiscalYearStartMonth)) AS FiscalYear;  // Fiscal Calendar Year

and then use this like this:

Sum({<DOBStatus = {'C'},FiscalYear = {"<$(=YearName(Max(FiscalYear)))"}>}DOBQty)

edmondo_tassi
New Contributor III

Re: Lesser than clause for variable, not working

Sum({<DOBStatus = {'C'},FiscalYear = {'<$(=$(CurrentYear))'}>}DOBQty)

try this

best regards