Forum Discussion
alphanumeric columns
Hi Anonymous , is there a way to create numeric primary key in power bi? can i use index function to create primary key
Hi, powerbiexpert22
You can use the DAX function to create an Index calculated column to be used as a primary key though. But when you use these two calculated columns to create a relationship between two tables, you are prone to circular dependency issues. Using my previous data as an example, I used the following two DAX expressions to create a calculated column in each of the two tables:
IndexColumn = RANKX(ALL(Customers), 'Customers'[CustomerID], , ASC, DENSE)
IndexColumn = RANKX(ALL('Orders'), 'Orders'[CustomerID], , ASC, DENSE)
So, I would recommend creating the index column in the data source or in PowerQuery to ensure that there are no circular dependencies.
In the future, if you have any new questions about creating primary key columns, you can post a new thread so that the rest of the community can help you in a timely manner.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.