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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year number

I have a problem to compare the current year with the previous year.

sum({$<Year={$(=Max(Year-1))}>}if(Kontonummer >= 41250000 and Kontonummer < 49300000,SummeSoll-SummeHaben))*-1

sum({$<Year={$(=Max(Year))}>}if(Kontonummer >= 41250000 and Kontonummer < 49300000,SummeSoll-SummeHaben))*-1

the problem is, the current year is 2014 and the previous year 41639.

Why is in the previous year the number????

I formatted the field WJ in the script like this

    WJ,

    DATE(Date#(WJ,'YYYYMMDD'),'DD.MM.YYYY') AS DATE,

    DATE(Date#(WJ,'YYYYMMDD'),'YYYY') AS Year,

There are only two values in WJ, (20130101 and 20140101)

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith
MVP
MVP

Instead of:

DATE(Date#(WJ,'YYYYMMDD'),'YYYY') AS Year

Use the Year() function:

Year(Date#(WJ,'YYYYMMDD')) AS Year,

View solution in original post

4 Replies
Nicole-Smith
MVP
MVP

Instead of:

DATE(Date#(WJ,'YYYYMMDD'),'YYYY') AS Year

Use the Year() function:

Year(Date#(WJ,'YYYYMMDD')) AS Year,

MK_QSL
MVP
MVP

sum({$<Year={'$(=NUM(Max(Year-1)))'}>}if(Kontonummer >= 41250000 and Kontonummer < 49300000,SummeSoll-SummeHaben))*-1



sum({$<Year={'$(=Max(Year))'}>}if(Kontonummer >= 41250000 and Kontonummer < 49300000,SummeSoll-SummeHaben))*-1

MarcoARaymundo
Creator III
Creator III

Hi!

Andreas Max(Year-1) it is not correct, the corret is: (Max(Year)-1)

Or try this:

Current year => Year(Today())

Previous year => AddMonths(Year(Today()), -12)

Not applicable
Author

Thank u

good to work with profis....