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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors