Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

oseimuduame
Contributor

Double Qty Persists

Good Afternoon,

i had an issue some months Back and i got a response.

The issue is that i was experiencing Double Qty some times back and i used DISTINCT to correct this and it worked for sometime only for me to realize now that there are still some occurences of the Duplicate item qty.

Please any idea on how to resolve this.

//inventory qty

SQL SELECT DISTINCT

  TO_CHAR(q.ITEM_SID) AS "ITEM_SID",

  q.SBS_NO AS "SBS_NO",

  q.STORE_NO AS "STORE_NO",

  q.QTY as "OH_QTY",

  q.MIN_QTY as "MIN_QTY",

  q.MAX_QTY as "MAX_QTY",

   q.TRANSFER_IN_QTY as "TRANS_IN",

  q.TRANSFER_OUT_QTY as "TRANS_OUT",

  (n.COST * q.QTY) AS "EXT_COST"

FROM INVN_SBS_QTY q

INNER JOIN INVN_SBS n ON n.ITEM_SID = q.ITEM_SID

WHERE q.STORE_NO < 250 AND q.SBS_NO in $(subsidiaries);

Thank You.

10 Replies
sasiparupudi1
Honored Contributor III

Re: Double Qty Persists

Where do you see the double qty in which field? this looks like asql issue rather than a qlikview issue

fvelascog72
Valued Contributor

Re: Double Qty Persists

Hi,

Maybe duplicated values in INVN_SBS?

Saludos

shiveshsingh
Honored Contributor

Re: Double Qty Persists

Is your data in INVN_SBS_QTY and INVN_SBS is unique?

Are you facing issue after join?

oseimuduame
Contributor

Re: Double Qty Persists

I am seeing the Double Qty in the INVN_SBS_QTY which means that for most of the Items the QTY is double e.g 7 will become 14. This was why i used distinct but still experiencing the double qty

oseimuduame
Contributor

Re: Double Qty Persists

The DB cannot hold Double Values i have double Checked. I picked on item and i checked the QTY on the Software and Compare to Qlikview it still Duplicating.

Any help please.

oseimuduame
Contributor

Re: Double Qty Persists

Yes the Data are UNIQUE..

And i think the Duplicate comes after Joining.

Any help please

shiveshsingh
Honored Contributor

Re: Double Qty Persists

Then there can be an issue in joining. May be one value is getting joined to 2 values in another table.

Need to debug!

Can you share your app?

qv_testing
Valued Contributor

Re: Double Qty Persists

I think you have one to many relation.

may be data repeating twice.

Table1:

IDAmount
100200
200300
300400

Table2:

IDCategory
100A
100B
200C
300R
300R

If we use inner join data repeats, because we have one to many...Ab.JPG

Instead of Inner Join use Inner Keep.  (Convert into Qlikview)

Ab.JPG

I think your query is simple, better to convert into Qlikview, and use left Keep.

that would work.

Thanks....!

oseimuduame
Contributor

Re: Double Qty Persists

I tried this script but keep saying Missing Keyword...

//inventory qty

SQL SELECT

  TO_CHAR(q.ITEM_SID) AS "ITEM_SID",

  q.SBS_NO AS "SBS_NO",

  q.STORE_NO AS "STORE_NO",

  q.QTY as "OH_QTY",

  q.MIN_QTY as "MIN_QTY",

  q.MAX_QTY as "MAX_QTY",

   q.TRANSFER_IN_QTY as "TRANS_IN",

  q.TRANSFER_OUT_QTY as "TRANS_OUT",

  (n.COST * q.QTY) AS "EXT_COST"

FROM INVN_SBS_QTY q

LEFT KEEP INVN_SBS n ON n.ITEM_SID = q.ITEM_SID

WHERE q.STORE_NO < 250 AND q.SBS_NO in $(subsidiaries);

Am i missing something here

Community Browser