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.

0

Table.AddColumn and Table.DuplicateColumn may display invalid data (types) that can not be loaded

Issue moved from the old issue site (and slightly refined)

 

If you supply a columnType with Table.AddColumn or Table.DuplicateColumn (e.g. Byte.Type), then the Query Editor will also display values that are out of range for the Data Type.
E.g. for Data Type Byte, values >255 are still displayed in the Query Editor, but they won't load to the table when the query is applied, meaning: leaving loaded fields empty in the data model.

 

This differs from Table.TransformColumnTypes which will result in an Expression.Error when data is out of range.

My suggestion would be to use the same apporach for Table.AddColumn and Table.DuplicateColumn.

 

Note: even some automatically created code suffers from this; I'll raise a separate issue for that.

 

Status: Delivered
Comments
MarcelBeug
Community Champion
v-haibl-msft
Employee

@MarcelBeug

 

I can repro the same issue as you. I’ve reported it internally to Power BI Team: CRI 30719636

I’ll post here once I get any update about it.

 

Best Regards,

Herbert

Vicky_Song
Impactful Individual
Status changed to: Accepted
 
v-haibl-msft
Employee

@MarcelBeug

 

I’ve got response from the team.

 

This is by design; see the language specification at http://download.microsoft.com/download/8/1/A/81A62C9B-04D5-4B6D-B162-D28E4D848552/Power%20Query%20Fo... for the gory details.

 

Basically, the types of table columns are advisory. That means, it's not a contract which promises the values will actually have that type; it's just a marker which says you think the values should have that type. When you supply a type parameter to Table.AddColumn, you're asserting that you think the value will have that type but nothing enforces it. If you need the enforcement, you can either use "Byte.From" in your formula or you can add a subsequent transformation step to type "byte".

 

Best Regards,

Herbert

Vicky_Song
Impactful Individual
Status changed to: Delivered
 
MarcelBeug
Community Champion

Your responses keep amazing me.