Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
W4ld
Contributor II
Contributor II

Where year>2017

Hi,

this is my first question I'm posting here, I hope I don't make to many mistakes.

In my script, I LOAD data from a qvd, that another app programed by somebody else made from multiple csv. That works pretty good, but now I tried to put a where-clause in my load statement, in order to only load real data and not the fake test data. To do so, I say where(yearmonth>201699)

According to my understanding, this should give me all the data from the year 2017 and onwards. However I discovered, that the year 2016 still is in my Dashboards, it just doesn't contain data anymore. I had the same result when trying to exclude 2017 the same way, that year contains real data. Since the point of this is reduce potential misunderstandings for people who use my app and don't have any knowledge of the programming, this doesn't rly get me there.

What did I do wrong or is there another possibility to completely exclude all data from before 2017?

 

Thanks in advance and greetings from Germany!

2 Solutions

Accepted Solutions
sunny_talwar

How about this?

name:
LOAD yearmonth
     year('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as year,
     month('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as month,
     data
FROM [lib://QVD/Datasource\name2.qvd] (qvd)
Where Left(yearmonth, 4) > 2017;

View solution in original post

W4ld
Contributor II
Contributor II
Author

I figured it out, my solution and also yours works perfectly, the problem was other data, that shared fields with my data and that I hadn't used the where-command on.
So in case somebody else reads this and has a similar problem:
Use the where-clause on all data, that is connected to the data you want to filter.

View solution in original post

6 Replies
sunny_talwar

What is the exact script you are using?

marcus_sommer

Beside filtering your fact-data you might also need to filter your dimension-data (calendar).

- Marcus

W4ld
Contributor II
Contributor II
Author

name:
LOAD
yearmonth
year('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as year,
month('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as month,
data

FROM [lib://QVD/Datasource\name2.qvd]
(qvd);

 

Thats the (simplified) script right now.

W4ld
Contributor II
Contributor II
Author

I haven't had the time yet to get into the calendar-stuff, so everything there is in default mode right now. Would you mind elaborating?

sunny_talwar

How about this?

name:
LOAD yearmonth
     year('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as year,
     month('01.'&right(yearmonth,2)&'.'&left(yearmonth, 4)) as month,
     data
FROM [lib://QVD/Datasource\name2.qvd] (qvd)
Where Left(yearmonth, 4) > 2017;
W4ld
Contributor II
Contributor II
Author

I figured it out, my solution and also yours works perfectly, the problem was other data, that shared fields with my data and that I hadn't used the where-command on.
So in case somebody else reads this and has a similar problem:
Use the where-clause on all data, that is connected to the data you want to filter.