Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Specialist III
Specialist III

Hello Shazad,

Please use below code:

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

Hope this will help.

Regards!
Rahul

Not applicable
Author

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

petter
Partner - Champion III
Partner - Champion III

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
Champion III
Champion III

Try below, depends on how your variable is defined

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


or


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

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

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
Contributor III
Contributor III

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

try this

best regards