Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current Year Values

Hi All,

I am trying to count only values within the current calendar year and failing. Please could someone point me in the right direction!

I have the following

=count({<DateRaisedIMS={"=year(Today())"},ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

However this brings back every Value ID in the system

How do I tweak this to just bring back current calendar year figures? I do not want to define a date as it will be part of a dashboard

Thanks in advance

Toby

1 Solution

Accepted Solutions
sunny_talwar

Forgot to close the parenthesis after Year(DateRaisedIMS


Try this:


=count({<DateRaisedIMS={"=Year(DateRaisedIMS) = year(Today())"},ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

View solution in original post

16 Replies
Anonymous
Not applicable
Author

Do you need a dollar expansion ?

=count({<DateRaisedIMS={"$(year(Today()))"},ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

sunny_talwar

Try this:

=count({<DateRaisedIMS={"$(=year(Today()))"},ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

HTH

Best,

Sunny

jpenuliar
Partner - Specialist III
Partner - Specialist III

Try looking into InYear() function at help (F1)

Not applicable
Author

Hi Bill,

I don't know, I should have taken that out as it was used in a previous calculation and have tweaked that to try and get the result I was after

Toby

Not applicable
Author

Thanks Sun but unfortunately that did not work

Not applicable
Author

Thanks Jonathan I will take a look

sunny_talwar

Is DateRaisedIMS a date field???? If yes then you will need to further tweak your formula to be something like this:

=count({<DateRaisedIMS={"=Year(DateRaisedIMS = year(Today())"},ValueID={'*24*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}ValueID)

Not applicable
Author

Yes DateRaisedIMS is a date field and is the field I am using for all calculations, unfortunately the tweak you made did not work either.

jpenuliar
Partner - Specialist III
Partner - Specialist III

Something like:

If(InYear('01/05/2014',Today(),0),'Y','N') as CurrentYearFlag

you can add this in your Calendar Script, something like:

If(InYear(TempDate,Today(),0),1,0) as CurrentYearFlag,