Forum Discussion
Anonymous
6 years agoNot applicable
Set existing column as Primary key (index)
How do we set up existing column in a given table within the model as a primary key? Note that we do not want/need to create an additional index column. We want to tell the model: this column is ...
Anonymous
6 years agoNot applicable
It is about Power BI Desktop, as forum name suggests.
amitchandak
Super User
6 years agoIn power bi, I do not remember we use term index. Yes, we do create a table of distinct values(dimension) and join it back with the fact table. To make sure we are in a star schema model.
Table 4 = DISTINCT('Sales'[Brand])
This is the table for the brand from sales and joins on brand with sales
I can add a numeric key to brand
Id = RANKX(all('Table 4'),'Table 4'[Brand],,ASC,Dense)
I need to put back key to sales
//ID in sales table
brand id = minx(filter('Table 4','Table 4'[brand] = Sales[brand]),'Table 4'[ID])
now I can join brand[Id] and Sales[Brand Id]