Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, today i have a qlik code that selects all data from 2022 where i have the code with the following structure
```
LOAD
columns
FROM path
WHERE YEAR([%KeyTime]) >='2022'
```
The thing is. I want to get data from years between 2019 and 2023. Is there something I could use for that?
I mean, i figured I could write it like
```
LOAD
columns
FROM path
WHERE YEAR([%KeyTime]) >='2019'
AND YEAR([%KeyTime]) <='2023'
```
But using something like a between function would make it clearer and shorter, is there anything in QLIK that is similar to that?
Normally you could solve a problem in a thousand ways. I cannot tell you all possible ways there are. But I have never seen anyone written anything else than what you have done.
I would say no, there is no built in function for that. If there is a comparison with months within a year you could use the inyear-function. But there is no similar function for several years what I know of.
What you could do when you have several values to check though is one of the following that is quite easy.
Match(YEAR([%KeyTime]),2020,2021,2022)
Or first create an inline table
load inline * [
yearsToRead
2020
2021
2022
];
Then
LOAD
columns
FROM path
WHERE Exists(yearsToRead,year([%KeyTime]);
The inline-table could also be created by varialbes vMinYear and vMaxYears
There you have some alterantives