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: 
Not applicable

Selecting Data by Date range

Hello Qlikview community!

For the past few weeks i've been studying qlikview and till this moment i've managed to get by my own with the information i can find on this community. But now i have struggled with this kind of problem.

By example i have this kind of data(have taken a small peace of it)

DateSum
1/10/20161.00
1/10/2016-80,000.00
1/10/2016-30,000.00
1/10/201680,000.00
1/12/20164.00
1/12/201630,000.00
1/12/20165.00
1/13/20166.00
1/14/201630,000.00
1/14/20167.00
1/14/20168.00
1/14/20169.00

The task i need for qlikview is to exclude all negative Sum data and only same positive Sum data that is located between the same or next 2 days in Date range data. Negative Sum data will always come first.

So the answer will look like this:

  

DatumsSum
1/10/20161.00
1/12/20164.00
1/12/20165.00
1/13/20166.00
1/14/201630,000.00
1/14/20167.00
1/14/20168.00
1/14/20169.00

Thank you very much for your time to answer my question!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try this:

Check:

LOAD

  Autonumber(Date + IterNo() -1 & '|' & -Amount) as Check

FROM

  [Hide Date.xlsx] (ooxml, embedded labels, table is Sheet2)

WHILE

  IterNo() <=3;

Data:

LOAD Date, Amount

FROM

  [Hide Date.xlsx] (ooxml, embedded labels, table is Sheet2)

WHERE

  Not Exists(Check, AutoNumber(Date & '|' &  Amount))

  AND Amount >= 0;

DROP TABLE Check;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
sunny_talwar

This seems like aggregated data, would it be possible to share raw data with the output you are looking from that data?

Not applicable
Author

I'v created this sample data in excel to train with, cause I can't take the raw data at home. The raw data is qvd file created from Microsoft NaVision. The raw data have many more dimensions, but they are the same between each other for this task, so the only difference is in fields Date and Sum.

But here are my excel and qvw files.

Did i understand you question write?

Thank you.

sunny_talwar

I understand what you are trying to do, but unfortunately I don't think I have a way to solve this. May be swuehl‌ or gwassenaar‌‌ have a solution for you.

Best,

Sunny

Gysbert_Wassenaar

Try this:

Check:

LOAD

  Autonumber(Date + IterNo() -1 & '|' & -Amount) as Check

FROM

  [Hide Date.xlsx] (ooxml, embedded labels, table is Sheet2)

WHILE

  IterNo() <=3;

Data:

LOAD Date, Amount

FROM

  [Hide Date.xlsx] (ooxml, embedded labels, table is Sheet2)

WHERE

  Not Exists(Check, AutoNumber(Date & '|' &  Amount))

  AND Amount >= 0;

DROP TABLE Check;


talk is cheap, supply exceeds demand
Not applicable
Author

Just tried this code and it worked exactly as I was looking for. Thank you very much gwassenaar‌ and sunindia‌ for your help. I appreciate it!

Have a nice day!