Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimension with no unique key

i have a dimension without a unique key.

say for example, in Customer dimension, one customer can belong to many REP’s in same State.

how can I join this dimension with my Transactions fact table?

Ex Customer Table:

Customer1,State1,REP1

Customer1,State1,REP2

Customer1,State1,REP3…..

so, any ideas to generate a unique key in this scenario?

11 Replies
sushil353
Master II
Master II

Hi,

Can u provide structure for your FACT's and DIMENTIONS

HTH

Sushil

whiteline
Master II
Master II

Hi.

You could use AutonumberHash256 function to generate unique id:

AutonumberHash256(Customer, REP) as IDCustomerREP

Not applicable
Author

Hi Sushil & Whiteline,

i think, i didn't explain the scenario properly.

I do have Customer & State fields in sales fact table.

i need to connect this Sales table to Customer dimension by depending on those fields.

Thanks for your help.

MayilVahanan

HI

What are the fields in sales table??

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi ramasamy,

Sales:

SO No,Customer, State,Revenue.

Customer:

Customer,State,Rep.

Thanks for ur reply.

MayilVahanan

Hi

Then customer is common field to each other. so they automatically combine with each other but change the state field name as saleState. Otherwise, it form loop or synthetic key..

or

Try like this

Load customer&''&State as Key,customer as salesCutomer, state as salesState, revenue,soNo from sales;

Load customer&state as Key,state, customer ,rep from customertable where exists(Key,Key);

//by this,second table load only if key exists in the first table only..

see this link:

http://www.quickqlearqool.nl/?p=910

for join.

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

but the problem is customer&state as Key is not a unique key in Customer dimension.

one customer can have many rep's for same state.

Ex Customer Table:

Customer1,State1,REP1

Customer1,State1,REP2

Customer1,State1,REP3…..

MayilVahanan

Hi

then u tey first approach..make  customer field as common to both tsble n rename state field.. How u expecting

The result..can u post a sample file n expecting result..by that can easy  to solve ur requirement..

Join , inner join, left join, concantenate concept also use to combine tables but without kowing the expected result its difficult to find

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
erichshiino
Partner - Master
Partner - Master

I might be missing something but given a sales order it's not possible to tell the right sales rep.

Using Mayil approach, you can create a more complex key, using Customer & '|' & State & '|' & Rep as Key, but there would be no link to the sales, right?

If you provide us some data samples, we can better understand the problem.

Regards,

Erich