Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
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
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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