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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
igoto
New Member

Please help : type mismatch

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)

2 REPLIES 2
Anonymous
Not applicable

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.

lbendlin
Super User
Super User

what is behind "source" ?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.