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

Removing duplicate values

Hi all,

Please suggest I have sample data like ,

   

codesupplierdoc novalue
BQ1234v112000342151000
BQ1234v11200041235500
BQ1234v122100342151000
BQ1234v21200045612500
BQ1234v22210045612500
BQ1234v32210045211300

and I want to check if my last 5 digit of doc no. are same and it's having same value then it should make 0 for value where doc is starting from 12 and should show only value for doc starting with 22.

expected output as below,

   

codesupplierdoc novalue
BQ1234v112000342150
BQ1234v11200041235500
BQ1234v122100342151000
BQ1234v212000456120
BQ1234v22210045612500
BQ1234v32210045211

300

Regards,

Vijeta

8 Replies
Anil_Babu_Samineni

Can you try this?

Sample:

LOAD *, Right([doc no],5) as Right5DocNo Inline [

code, supplier, doc no, value

BQ1234, v1, 1200034215, 1000

BQ1234, v1, 1200041235, 500

BQ1234, v1, 2210034215, 1000

BQ1234, v2, 1200045612, 500

BQ1234, v2, 2210045612, 500

BQ1234, v3, 2210045211, 300

];

Right Join (Sample)

LOAD Right5DocNo, Max(value) as value Resident Sample Group By Right5DocNo Order By Right5DocNo ASC;

Create Chart

Dimensions are - code, supplier, [doc no]

Expression is

Sum(Aggr(Max(value), Right5DocNo))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

May be this?

Tab:

LOAD *, Right(docno, 5) AS Last5doc INLINE [

code, supplier, docno, value

BQ1234, v1, 1200034215, 1000

BQ1234, v1, 1200041235, 500

BQ1234, v1, 2210034215, 1000

BQ1234, v2, 1200045612, 500

BQ1234, v2, 2210045612, 500

BQ1234, v3, 2210045211, 300

];

Right JOIN

LOAD code, supplier, docno, Last5doc, IF(Last5doc = Peek(Last5doc), 0, value) AS value

Resident Tab

Order By value;

vijetas42
Specialist
Specialist
Author

Hi,

Thanks for your reply.above logic is working fine on dummy data but when I incorporate it with actual it takes lot of time to load.Is there any other way arround.

vishsaggi
Champion III
Champion III

I am not sure, did you try Anil's script did it take the same time usually doing this at script level should help. May be you want to create a qvd out of this script based on your original data and just load that QVD for your dashboard development may be an option?

vijetas42
Specialist
Specialist
Author

Anil's script didn't worked for me. and I am trying to resolve the same at script level but still did't get any solution.

vishsaggi
Champion III
Champion III

Does your actual data is stored in a QVD or just a database source table?

Anonymous
Not applicable

The field Key (QVD) is correty with join?

vijetas42
Specialist
Specialist
Author

in Qvd