Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare current and previous record

Hi,

I need to compare column value between current and previous record to identify duplicates , how to do so?

example


Store Name, Store Description

Previous Record: 'S1',' Grossary'

Current Record: 'S1', 'Grossary'


In above example I want to compare 'Store Name' column values between Previous and Current records

7 Replies
othniel2014
Contributor III
Contributor III

Store Name is the primary key?

See this information

https://community.qlikview.com/thread/159455

Not applicable
Author

no its not but this is just criteria to identify "Duplicate" as per business it has nothing to do with actual meaning of duplicates

vishsaggi
Champion III
Champion III

May be try this : I am not sure if this is what you are looking for. Added some dummy data below:

LOAD *,

     RowNo() AS RowCount,

     IF(StoreName = Previous(StoreName), 'Duplicate', 'Not Duplicate') AS DuplicateCnt;

Load * Inline [

StoreName, StoreDesc

'S1','Grossary'

'S1','Grossary'

'S2','Summary1'

'S1','Gross'

'S2','Summary'

'S2','Summary'

];

Populate these values in a straight table with

Dim: StoreName, StoreDesc, RowCount

Expr: DuplicateCnt

In presentation tab hide Column RowCount.

effinty2112
Master
Master

Hi Vibhu,

               In your load script add this line:

Autonumber(StoreName & '|' & StoreDesc, 'CheckID') as CheckID

Then

Left Join

Load

CheckID,

Count(CheckID) as CountID

Resident YourTable Group by CheckID;

Now if you select in your dashboard CountID >1 you will see the duplicates.

Regards

Andrew

Not applicable
Author

I am unable to sort the records in Load script due to this reason Previous function is not getting applied in correct way it should be

vishsaggi
Champion III
Champion III

Oh ok. Then probably it is not the comparison with current to previous, it should be any occurrence of StoreName more than once should be considered as duplicate? Did you try Andrew's script ?

Not applicable
Author

report should not be filtered on duplicates it should show both duplicates as well as non duplicates