Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Compare date and num

HI guys,

     i need to compare the date with the string, so I'm trying to run this code:

=num( sum( {< Current_Years={ Date( Date#( v_Year_Cur, 'YYYY')) }> } Quantity, '€ #.##0')

but this doesn't work.

I don't know why, can you help me?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

I think you need to check these links out

Why don’t my dates work?

Get the Dates Right

You are using order date which seems like a date and you are asking QlikView to interpret it as just YYYY. Is order date not understood as date by QlikView? If not, only then use Date#(). else just use Year([order date]) to extract year out of a date

View solution in original post

4 Replies
sunny_talwar

v_Year_Cur looks like a number to me.... Is Current_Years field a just a Year or is it a date?

Update: If it is date, then i would suggest you to calculate year from Current_Years in the script like this:

LOAD Current_Years as Date,

          Year(Current_Years) as Year

          ....

FROM ....;

and then this

=Num(Sum({<Year={$(=v_Year_Cur)}>} Quantity), '€ #.##0')

Anonymous
Not applicable
Author

I made a mistake, v_Year_Cur is a number not a string.

I create Current_Years in this way

LOAD Year(Date#([order date], 'YYYY')) as Current_Years,

          ...............

FROM......;

while I set v_Year_Cur is manually

sunny_talwar

I think you need to check these links out

Why don’t my dates work?

Get the Dates Right

You are using order date which seems like a date and you are asking QlikView to interpret it as just YYYY. Is order date not understood as date by QlikView? If not, only then use Date#(). else just use Year([order date]) to extract year out of a date

Anonymous
Not applicable
Author

Thank you