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

Comparions

HI,

please have a look at my example. I must build a comparison between OUT and IN Plants. When there is the same date on a plant OUT in comparison to a plant IN something went wrong.

Example:

ID 1 have plant B OUT: 2.2.2015 and plant D IN: 2.2.2015    THIS IS WRONG!

And now I want to have a new table which shows me ID:1; Date: 2.2.2015; Exception: 3

Next example:

ID 2 have plant U OUT: 2.2.2015 and plant D IN: 5.2.2015 THIS IS CORRECT because they have different dates...

SO how to build such a table like in example 1?

Thank you... !

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try this:

Table:

LOAD *, if(ID=Previous(ID) and IN=Previous(OUT),3) as Exception INLINE [

    ID, Plants, IN, OUT

    1, B, 1.1.2015, 2.2.2015

    1, D, 2.2.2015, 5.2.2015

   

    2, U, 1.1.2015, 2.2.2015

    2, D, 5.2.2015, 10.2.2015

   

    3, U, 1.1.2015, 3.3.2015

    3, A, 3.3.2015, 5.3.2015

    3, F, 5.3.2015,

];


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
sunny_talwar

How do you get to know if something is in or out? All I am seeing is three field with no in or out information here:

Capture.PNG

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try this:

Table:

LOAD *, if(ID=Previous(ID) and IN=Previous(OUT),3) as Exception INLINE [

    ID, Plants, IN, OUT

    1, B, 1.1.2015, 2.2.2015

    1, D, 2.2.2015, 5.2.2015

   

    2, U, 1.1.2015, 2.2.2015

    2, D, 5.2.2015, 10.2.2015

   

    3, U, 1.1.2015, 3.3.2015

    3, A, 3.3.2015, 5.3.2015

    3, F, 5.3.2015,

];


talk is cheap, supply exceeds demand