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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sekharQV
Creator
Creator

Remove Unwanted rows from Straight Table while loading

Hi All,

Hope you are doing well.

I facing problem in below requirement.

i have created a Straight table like below.

So my requirement is to

Contract NoDescUnit NoPrice
2Desc2U2500
3Desc3U3450
4Desc4U4580
4Desc44U4580
5Desc5U5756
6Desc6U6954
7Desc7U7246
7Desc7.1U7246
7Desc77U7246
8Desc8U8256
9Desc9.9U9543
9Desc9U9543
9Desc9.1U9543
9Desc79.2U9543
9Desc9.3U9543
9Desc99U9543

Here some of contract numbers are repeating because their descriptions are different and remaining all columns are same.

So, my requirement is to display only one row for each contract no which are loading first and to exclude remaining rows.

So output should be like below.

Contract NoDescUnit NoPrice
2Desc2U2500
3Desc3U3450
4Desc4U4580
5Desc5U5756
6Desc6U6954
7Desc7U7246
8Desc8U8256
9Desc9.9U9543

I am attaching sample data QVW file for your reference.

Please help.

Thanks,

Raja

6 Replies
sunny_talwar

Try this

ContractTable:

LOAD * INLINE [

    Contract No, Desc, Unit No, Price

    2, Desc2, U2, 500

    3, Desc3, U3, 450

    4, Desc4, U4, 580

    4, Desc44, U4, 580

    5, Desc5, U5, 756

    6, Desc6, U6, 954

    7, Desc7, U7, 246

    7, Desc77, U7, 246

    7, Desc7.1, U7, 246

    8, Desc8, U8, 256

    9, Desc9.9, U9, 543

    9, Desc9.1, U9, 543

    9, Desc99, U9, 543

    9, Desc79.2, U9, 543

    9, Desc9, U9, 543

]

WHERE NOT EXISTS([Contract No]);

sekharQV
Creator
Creator
Author

HI Sunny,

Thanks for your reply.

Your solution is working fine with inline data. But when work with actual fields which are coming from db, it is not working as expected.

I am loading following fields:CID, CCODE, Contract No, Package, Desc, Unit No, Price, StatDate etc.(w.r.to granularity i mentioned the fields)

And i am joining this fact table with another fact table(left keep) based on CID, CCODE, Contract No, Unit No


Can you pls suggest me how to achieve my requirement.


Thanks&Regards

Raja

sunny_talwar

Do you have Contract No loaded before somewhere else in the script before you bring it here?

PrashantSangle

Hi,

just one query on what basis you are selecting which description you have to use when there is 2 records for 1 contract no??

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sekharQV
Creator
Creator
Author

I  have contractno in both fact tables along with some other common keys(CID, CCODE,Unit No).

So i am joining both tables(left keep) based on composite key of  CID, CCODE, Contract No, Unit No



sekharQV
Creator
Creator
Author

the records are repeating because of different descriptions for one contract number and all other values are same.

and sorry for not mentioning one more point.

The contractno's are based on package(field).

If a contractno has different descriptions with same package the only any of record(if possible 1st record) should be loaded and to be shown in report(if there are 5 records for this scenario then only one record should be loaded)

And if  a contractno has different descriptions with different descriptions then all records should be loaded(if there 5 records for this scenario then all 5 records should be loaded)

I thinks so u got it. please let me know if any further clarification required.

Thanks,

Raja