Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alessandrotk
Contributor II
Contributor II

If record value equals to previous then skip (script help)

Hi!

Could someone help me build this script in Qlik Sense?

I have "price" listed on a chronological base and, if the price is equal to previous date record, it should be skipped (dismissed).

Table on the left my source data and table on the right my expected result:

last_value_change.jpg

Thanks!

Labels (2)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

Perhaps like this:

tmpData:
LOAD
    Product,
    Date,
    Price
FROM
    ...source_table...
    ;

Result:
NOCONCATENATE LOAD
   Product,
   Date,
   Price
WHERE
    Flag =1
    ;
LOAD
    Product,
    Date,
    Price,
    If(Previous(Product)<>Product OR Previous(Price)<>Price,1,0) as Flag
RESIDENT
    tmpData
ORDER BY
    Product,
    Date DESC
    ;

DROP TABLE tmpData;

talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

Perhaps like this:

tmpData:
LOAD
    Product,
    Date,
    Price
FROM
    ...source_table...
    ;

Result:
NOCONCATENATE LOAD
   Product,
   Date,
   Price
WHERE
    Flag =1
    ;
LOAD
    Product,
    Date,
    Price,
    If(Previous(Product)<>Product OR Previous(Price)<>Price,1,0) as Flag
RESIDENT
    tmpData
ORDER BY
    Product,
    Date DESC
    ;

DROP TABLE tmpData;

talk is cheap, supply exceeds demand