Forum Discussion
Unable to import table
Hi,
Please help in importing table in Power BI. I am getting below error while importing the table.
= let
tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
fieldNames = Record.FieldNames(recordTypeFields),
fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = "The type of the value does not match the type of the column.", Detail = v], fieldTypes{i}})
in
Table.TransformColumns(Source, pairs)
= Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1)
Error is belong to below Column. This column contain data in % as well as text.
This column contain % as well as text.
Thanks in advance.
- Anonymous3 years ago
Hi Sadr_Hoda ,
As far as I know, Power BI doesn't support to keep two data types in one column at the same time, due to Power BI will calcualte based on column. So you will get error when you change the column to number type. Here I suggest you to show data with different data type in different columns.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandakSuper User
Sadr_Hoda , List.Positions(fieldNames) is going to give a numeric list, make sure it handled like that
- Sadr_HodaFrequent Visitor
Hi Amit,
filed contain both text and numbers. Yes PowerBI considering field as numeric list and showing error on text data.
Any option to import data with both number and text in a single column.
Regards,
Sadr
- AnonymousNot applicable
Hi Sadr_Hoda ,
As far as I know, Power BI doesn't support to keep two data types in one column at the same time, due to Power BI will calcualte based on column. So you will get error when you change the column to number type. Here I suggest you to show data with different data type in different columns.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.