Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What is perfect key in Qlikview?

tell me any one

6 Replies
crusader_
Partner - Specialist

Hi,

Perfect key is positive serial number key. (1, 2, 3, 4, 5 etc)

You can achive it using Autonumber() function.

Hope this helps.

Andrei

richard_pearce6
Luminary Alumni

You would normally stay away from synthectic keys and data loops also

Not applicable
Author

Key with density and proportion of subset of 100% ....

that's a perfect key for me 😃

maxgro
MVP

from book

Qlikview for Developers

[Perfect Key] indicates that every row contains a key value, and that

all of these key values are unique. At the same time, the field's subset

ratio is 100 percent. This qualifier should be seen in dimension tables,

where every key should uniquely identify a single record.

Not applicable
Author

Additionally, here is more clarification form the book.

[Primary Key] indicates that all key values are unique, but not every row contains a key value or the field's subset ratio is less  than 100 percent.

[Key] indicates that the key is not unique. This qualifier is usually seen in fact tables, where the same dimension value may be associated with many different facts.

Anonymous
Not applicable
Author

Perfect Key Vs Primary key:

The [Perfect Key] is a bit more: it is a [Primary Key] (unique) with no "orphans".

Let me clarify this with 2 examples:

Example 1)

InvoiceDetails:

LOAD *

INLINE [

InvoiceID, InvoiceLine, ProductID, Quantity, Amount

Inv001,1,PR01,10,50

Inv001,2,PR02,10,40

Inv002,1,PR01,30,150

Inv002,2,PR03,10,800

];

Invoices:

LOAD *

INLINE [

InvoiceID, ClientID

Inv001,CL0001

Inv002,CL0002

];

In this example, InvoiceID is [Key] in InvoiceDetails and [Perfect Key] in Invoices: it is unique and it has no orphans.

Example 2)

InvoiceDetails:

LOAD *

INLINE [

InvoiceID, InvoiceLine, ProductID, Quantity, Amount

Inv001,1,PR01,10,50

Inv001,2,PR02,10,40

Inv002,1,PR01,30,150

Inv002,2,PR03,10,800

Inv003,1,PR01,10,50

];

Invoices:

LOAD *

INLINE [

InvoiceID, ClientID

Inv001,CL0001

Inv002,CL0002

];

In this example, InvoiceID is [Key] in InvoiceDetails and [Primary Key] in Invoices. There is a value in InvoiceDetails, Inv003, that does not find a corresponding value in the Invoices table. This is called a "orphan". For this reason InvoiceID is not anymore perfect, but it is still primary, because it is unique.

If you copy-paste the example you can verify it

BR,

Chinna