The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I get the following error message when editing a query in Power BI.
"A type mismatch has been detected."
I don't know where in the table is the type mismatch.
Is there any way to find out where it should be fixed?
----------------------------------------------------------------
= 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 value type does not match the column type." , Detail = v], fieldTypes{i}})
in
Table.TransformColumns(source, pairs)
---------------------------------------------------------
Translated with www.DeepL.com/Translator (free version)
Hi @igoto ,
What is your data source? I think it may be a data type error, you can try to format all the columns as text, then change the data type one by one, and check which column causes this error.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
what is behind "source" ?