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: 
knightwriter
Creator III
Creator III

Load query: Year

Hi All,

My dashboard showed only one years worth of data in 2015. I now want it to show 2016 and the same 2015 data. I have created the selection filters but when I reload the script only a small part of this data shows for both years.

I am using the below script and seek any guidance to fix this issue?

LOAD * FROM \\sample.qvd (qvd)

Where (InYear([Planned Date], Today(), 0) or InYear([Planned Date], AddYears(Today(), 1), 0))

6 Replies
tamilarasu
Champion
Champion

Try,

LOAD * FROM

sample.qvd (qvd)

Where Year([Planned Date])=Year(today()) or Year([Planned Date]) =Year(Today())-1;

Anonymous
Not applicable

your where clause refers to 2016 (first part) and 2017 (second part with addyears(today(),1))

if you want your plkanned data for 2015 and 2016 you Need to modify the second part to

or InYear([Planned Date], AddYears(Today(), -1), 0))

do you Show only planned data or do you want to include actual data as well?

Anonymous
Not applicable

like this?

LOAD * FROM \\sample.qvd (qvd)

Where (InYear([Planned Date], Today(), 0) or InYear([Planned Date], AddYears(Today(), -1), 0))

Peter_Cammaert
Partner - Champion III
Partner - Champion III

LOAD * FROM \\sample.qvd (qvd)

WHERE Year([Planned Date]) >= (Year(Today()) - 1);

Best,

Peter

knightwriter
Creator III
Creator III
Author

Apologies, typo on my behalf - Yes, I use AddYears(Today(), -1), 0)).

I believe I have to change all the text object properties too?

Currently I have:

Count(Distinct If([Status]='Completed' AND InYear([Date], Today(), 0), [Id], ))

Do I need to include the "Or" function to include my 2015 data?

knightwriter
Creator III
Creator III
Author

Thanks Peter,

I have now included this in the script but need to update the Text Object Properties. My equation is rather long and I know its not showing the correct result. Is there a way to shorten this?

=Num (Count(Distinct If([Company.Car Order]='BMW' AND [Status]='Completed' AND InYear([Completed Date], Today(), 0) or InYear([Completed Date], Today(), -1), [Id], )), '###,###')