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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
dof
New Member

Literal is typed as Decimal when I want int

I am adding a custom column with the following syntax

 

=Table.AddColumn(PrevStep,"One", each 1, Int8.Type)

 

The column is added, but in the column header I can see that it has been typed as a Decimal Number.

 

Any idea why?

 

(I can change this manually in the next step, but I'm interested to know if I'm doing something wrong.)

 

Thanks.

1 ACCEPTED SOLUTION
jennratten
Super User
Super User

Sorry about that! LOL!  I've added the intended link below. 

https://docs.microsoft.com/en-us/powerquery-m/power-query-m-type-system 

 

You are correct, the type names don't necessarily align to the actual types.  Below is a quote from https://bengribaudo.com/blog/2020/02/28/5009/power-query-m-primer-part17-type-system-ii-facets 

 

Instead, these “Type” names are simply names associated with expressions that return the appropriate type to use for whatever the name describes, decorated with the applicable type claim facet. For example, Int8.Type is a name associated with an expression that returns a type value of the correct type to use for 8-bit integers (type number) decorated with a type claim facet of “Int8.Type”

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

View solution in original post

4 REPLIES 4
jennratten
Super User
Super User

Sorry about that! LOL!  I've added the intended link below. 

https://docs.microsoft.com/en-us/powerquery-m/power-query-m-type-system 

 

You are correct, the type names don't necessarily align to the actual types.  Below is a quote from https://bengribaudo.com/blog/2020/02/28/5009/power-query-m-primer-part17-type-system-ii-facets 

 

Instead, these “Type” names are simply names associated with expressions that return the appropriate type to use for whatever the name describes, decorated with the applicable type claim facet. For example, Int8.Type is a name associated with an expression that returns a type value of the correct type to use for 8-bit integers (type number) decorated with a type claim facet of “Int8.Type”

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

Thank you for your answer, but do you know if it's usefull for the performance to store as 8bit type instead of the default 64 ?

jennratten
Super User
Super User

Hello - it is due to the type being specified as Int8.Type and how Power Query handles numeric types.  If you change it to Int64.Type you will see it as a whole number.  I have included some links below if you would like to read more about the type system.

https://community.powerbi.com/t5/Power-Query/Literal-is-typed-as-Decimal-when-I-want-int/m-p/2269132... 

https://bengribaudo.com/blog/2020/02/28/5009/power-query-m-primer-part17-type-system-ii-facets 

 

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

Hi Jen.  The first link you sent is to my question 😉  I skimmed over the second link, but it still seems curious that it doesn't recognise Int8, Int16, Int32 as integers, although it perhaps does....is it just the icon on the column header that is misleading?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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