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

Managing surrogate keys for dimension tables with Power Query

Hi,

I'd like to know how managing better the surrogate keys for dimension tables with Power Query.

I've accomplish a proof.

I've imported MyFact and MyDimension tables. MyDimension table has B_key_dim as a primary key (the business key), MyFact table has B_key_dim as a foreign key for referring to MyDimension table.

For MyDimension table I've created an index column, S_key_dim (the surrogate key). Then, I've merged MyFact with MyDimension to implement an inner join and to get S_key_dim. Now, I'd like to delete B_key_dim colums in both MyFact and MyDimension, but I've an error when I delete B_key_dim column in MyDimension.

 

Any suggests to me, please? Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Yuliana,

 

by creating a copy of MyDimension table, having the index from the original table, to merge with MyFact table is possible to remove the business keys in both MyFact and MyDimension.

It should be useful to know if choosing an index as a surrogate key save memory respect to a business key like a GUID.

 

Thanks

View solution in original post

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Did you get below error when you attempted to delete B_key_dim column?

1.PNG

 

As mentioned in error message, "The column 'B_Key_dim' wasn't found", that case, the new merged table is failed to be generated. Because the mapping key did not exist.

 

Based on my test, if you choose "Merge queries as new", you cannot delete the B_key_dim column in source two tables. But you can delete the repeated B_key_dim column in new merged table.

 

If you choose "Merge Queries" option, for example, you merge MyFact table to MyDimension table, at the last step, you could delete B_key_dim column in MyDimension.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Ok, but I'd like to delete B_key_dim colums in both MyFact and MyDimension, not only in one table.

Thanks

Hi @Anonymous,

 

I'm afraid this is not supported.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana,

 

by creating a copy of MyDimension table, having the index from the original table, to merge with MyFact table is possible to remove the business keys in both MyFact and MyDimension.

It should be useful to know if choosing an index as a surrogate key save memory respect to a business key like a GUID.

 

Thanks

Hi @Anonymous,

 

Thanks for your sharing.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.