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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Sander8000
Frequent Visitor

Key is too long for Power Query creating duplicate keys

Hi All,

 

So I am importing a table from snowflake with business keys with a length of 18 characters. Upon loading in PowerBI via Power query I am bound by the length limitation of the integer of 15 characters. As such my keys are rounded on the last 3 digits (see table) and giving me errors with duplicate keys in my datamodel.

 

I know I can convert to whole number in power query using TransformColumnType, but this seems to affect my query folding/ incremental loading. From what I understood I should be able to do this upon my import using a cast or format, but so far no luck. 

 

237608206420221003237608206420221000
23760820642022102423760820642022100
237608206420221010237608206420221000
237608206420221107237608206420221000

 

I tried the below but did not work

  • select CAST(TABLEKEY AS BIGINT) from EDM.TABLE

 

Any ideas?

1 ACCEPTED SOLUTION
davidding
Resolver I
Resolver I

18-19 digits is the hard limit in power query M according to: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-data-types#fixed-decimal-number 

 

But in your case, looks like you might be able to break it into 3 smaller parts? e.g. 2376082064 20221107 237608206420221000

View solution in original post

4 REPLIES 4
Sander8000
Frequent Visitor

thanks all for your help. This worked for me,

 

Cheers

Sander8000
Frequent Visitor

I was able to cut them in half: 237608206420221107 reducing the size to 18 character, but this is still too much for power query (integer format). The length of this key would limit some features in Power BI desktop indeed, but the key is not needed for visuals, purely for data modelling. 

 

To import the data in powerbi desktop I use a SQL statement to import my data. I was hoping I could transform the dat upon import thereby hopefully not impacting my query folding and incremental loading.

 

Something like: 

  • select CAST(TABLEKEY AS BIGINT) from EDM.TABLE
jennratten
Super User
Super User

@Sander8000  It also looks like there are repeating values within the keys.  Those could be good options for separation/elimination also. If these are intended to be used as unique keys it would be good to understand the components used to create this long key and the purpose; what constitutes each set of characters in the key and what does that set represent. If none of this is known then you could create an index for these which would immediately drop the length, however, if you are needing to join with other tables, you would need to know the logic so you could do it correctly.   

 

jennratten_1-1721572819914.png

jennratten_2-1721572919690.png

 

jennratten_0-1721572562960.png

 

davidding
Resolver I
Resolver I

18-19 digits is the hard limit in power query M according to: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-data-types#fixed-decimal-number 

 

But in your case, looks like you might be able to break it into 3 smaller parts? e.g. 2376082064 20221107 237608206420221000

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors