Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Table Relation Performance: ID (with lookupvalue) vs Text

I would like to know what your guys oppinions on a best practice model are?

If I have two tables, say fact and dim that I want to create a relationship with, which one of the two is better:

 

a) create a Calculated Column in fact-table with lookupvalue on the text column in dim-table and get an ID for the relationship

b) make relationship based on text column between fact-table and dim-table

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

For power bi data modeling, you can take a look at the official document:

Understand star schema and the importance for Power BI 

For the two methods you mentioned, they should base on your table data amount.
If you are working with a small fact table, you can add a calculated column to lookup value. If you are work with table existed huge amount of records, method b should better for performance.

Optimization guide for Power BI - Power BI | Microsoft Docs

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
sayaliredij
Super User
Super User

It depends. Need to see what query is being created for such DAX.  But what I can imagine that it might work in some scenarios but in many scenarios, it will be a problem.

 

But in this case, I would always try to add a surrogate key in the source. Eg. if it's a database then when you are populating the fact table you can try to add this dimsurrogatekey there. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




sayaliredij
Super User
Super User

It depends on number of rows in your model.

 

If you are dealing with small model , then joining text columns should be fine

But look up will create more complexity in the model and I think it will not gain any performance benefits. 

 

It is always better to use integers as relationship keys. which you can either try to create in power query or if you are using any database system then there. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thanks for your answer. My question is for a large dataset, lets say millions of rows and multiple fact tables potentially.
Power query isnt a fitting option since joining the dim to the fact based on a text column is usually very slow and not feasible. Say you have 3 dim tables, it doesnt make sense to join all these into fact just for numeric key.
Does that mean using lookupvalue to get id for relationship is never a good option with big models?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.