6 Replies Latest reply: Aug 30, 2017 11:05 AM by edmondo tassi

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

Thanks & Regards,

• ###### Re: Lesser than clause for variable, not working

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

Hope this will help.

Regards!
Rahul

• ###### Re: Lesser than clause for variable, not working

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

• ###### 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...

• ###### 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)

• ###### Re: Lesser than clause for variable, not working

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

try this

best regards