Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Olá, sou novo no Qlik e estou precisando de ajuda.
Gostaria de saber como faço para relacionar as tabelas "admitidos", "Headcount", "Demitidos" com a tabela "De_Para" e com a tabela de calendário que criei, para o relacionamento com a tabela "De_Para" uso a coluna "Centro de Custo" e para o relacionamento com a tabela "Calendário" uso a coluna de "Data".
É possivel fazer isso sem chave sintética?
@Rolopes1 In this case, I feel that even if you avoid the synthetic keys, you will have to create an equivalent link table to get the relationships you want.
Do you want De_Para to be related to Calendario via Data? if not, rename Data in De_Para. But if you do, then it tells me that Data+Centro de Custo is the key for the four tables, namely Admitidos, Headcount, Demitidos, and De_Para.
If Data+Centro de Custo is the key, then you can use Concatenate to make the 4 tables into one table as follows:
// Force concatenation even if there are differing columns
Load *, 'Admitidos' as Type
Resident Admitidos;
Concatenate
Load *, 'Headcount' as Type
Resident Headcount;
Concatenate
Load *, 'Demitidos' as Type
Resident Demitidos;
Concatenate
Load *, 'De_Para' as Type
Resident De_Para;
drop table Admitidos, Demitidos, Headcount, De_Para;
The other option is to create your own link table. This means extra steps and extra processing, but a much cleaner data model than having synthetic keys (but note that synthetic keys are providing a link table for you automatically).
// Create a key with Data & [Centro de Custo]
Load Data & '|' & [Centro de Custo] as key,
// -- Snip --
Resident Admitidos;
Load Data & '|' & [Centro de Custo] as key,
// -- Snip --
Resident Headcount;
Load Data & '|' & [Centro de Custo] as key,
// -- Snip --
Resident Demitidos;
Load Data & '|' & [Centro de Custo] as key,
// -- Snip --
Resident De_Para;
// Create link table
Link_Table:
Load key, Data resident Admitidos;
Load key, Data resident Headcount;
Load key, Data resident Demitidos;
Load key, Data resident De_Para;
// Remove Data & [Centro de Custo] or rename uniquely
Remove fields Data, [Centro de Custo] From Admitidos;
Remove fields Data, [Centro de Custo] From Headcount;
Remove fields Data, [Centro de Custo] From Demitidos;
Remove fields Data, [Centro de Custo] From De_Para;