Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
tell me any one
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
You would normally stay away from synthectic keys and data loops also
Key with density and proportion of subset of 100% ....
that's a perfect key for me 😃
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.
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.
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