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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Detected Type Mismatches

Hi experts,

 

As you see in the Applied Steps, I didn't change any data type, but I got the error message in the subject line.  When I got the message, the query group (Query Errors) was created.  How can I fix this?  Greatly appreciate it. 

 

 

nbtong_0-1716321312537.png

 

nbtong_1-1716321346680.png

 

Below is the query in the Advanced Editor.  There is no step for changing any data type. 

 

let
Source = T_ACADEMIC_HISTORY,
#"Detected Type Mismatches" = 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),
#"Added Index" = Table.AddIndexColumn(#"Detected Type Mismatches", "Row Number" ,1),
#"Kept Errors" = Table.SelectRowsWithErrors(#"Added Index", {I removed columns here to simply, "TITLE", "DM_DESC3", "DM_DESC6"}),
#"Reordered Columns" = Table.ReorderColumns(#"Kept Errors", {"Row Number", Also removed columns here to simply, "TITLE", "DM_DESC3", "DM_DESC6"})
in
#"Reordered Columns"

 

 

 

1 ACCEPTED SOLUTION
jennratten
Super User
Super User

Hello - this table will automatically be created when you attempt to load data to the model and there are errors somewhere in the records.  The problem may or may not be a data type issue. The table created automatically includes the type mismatch step.  The best way to see the errors would be to view the errors table that was created.  Scroll through the columns and you should see a column which contains a value that looks like a hyperlink with the word Error.  If you click the hyperlink in the cell it will drill down to the error and tell you what the exact problem is.  You can also see the actual problem without drilling down by clicking on the white space next to the hyperlink (in the same cell) and a preview will appear which displays the actual error message.  I find that type errors are frequently numbers/dates that are attempting to be parsed as text or vise versa.

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

5 REPLIES 5
jennratten
Super User
Super User

Hi @Anonymous - Have you had a chance to take a look at these?  Please consider clicking Accept as Solution if this answered your question.  Thanks!

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

jennratten
Super User
Super User

Hi @Anonymous - just checking to see if you were able to resolve this.  Thanks!

 

If my response helped you please consider accepting it as the solution and/or liking it.

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

jennratten
Super User
Super User

Hello - this table will automatically be created when you attempt to load data to the model and there are errors somewhere in the records.  The problem may or may not be a data type issue. The table created automatically includes the type mismatch step.  The best way to see the errors would be to view the errors table that was created.  Scroll through the columns and you should see a column which contains a value that looks like a hyperlink with the word Error.  If you click the hyperlink in the cell it will drill down to the error and tell you what the exact problem is.  You can also see the actual problem without drilling down by clicking on the white space next to the hyperlink (in the same cell) and a preview will appear which displays the actual error message.  I find that type errors are frequently numbers/dates that are attempting to be parsed as text or vise versa.

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

Anonymous
Not applicable

Great!  Thank you for your kind explanation!  I have 3 million cases, so I'm not sure if I can locate the error cells, but will try and let you know.! 

You shouldn't need to check each one individually.  Getting the error message for one cell and fixing it will usually resolve all the errors in the column.

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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