How to create dimension table for item without primary key
Hi everyone,
I'm trying to create a dimension table for MailingCity that will be linked to my fact table. The goal for my fact table is to have ContactID and all other dimensions indexed so they link to their respective dimension tables (i.e. MailingCityID in fact table will link with MailingCityID in the MailingCity dimension table, etc).
MailingCity (and other dimensions associated with Contact) does not already have an ID, hence for each dimension, I'm creating a separate dimension table with that dimension being indexed. Only thing is I would have to merge the index tables back to the fact table using the qualitative dimension as the common denominator (i.e. MailingCity index table with Contact fact table using the MailingCity value). And repeat the merges for all other dimensions...which have been very costing on performance for me (Mashup container Out of Memory issues - cannot even open the old file now).
Hence, I'm trying to avoid merging dimension indexes back to the fact table to optimize model performance. So now I'm trying to create an index within dimension tables that contain both the ContactID and the MailingCity value itself.
In this screenshot below, many contacts can have a MailingCity (MC) value of London, Toronto, etc. So for each of these repeating MC values, I want to do a repeating index value for it as well. i.e. 1 for London, 2 for Toronto, etc.
Initially I followed RADACAD's tutorial but the result wasn't what I'm looking for: Create Row Number for Each Group in Power BI using Power Query - RADACAD
Result should be 1 for London, 2 for Toronto, etc.
Ideally it will say 0 for null or invalid MC values (i.e. like "--", etc), and start in chronological order with MC values beginning with A as 1, etc.
Also, please feel free to give me feedback on my approach to creating the dimension tables & fact table this way.
Thank you!