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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

"MS SQL: Conversion failed when converting the varchar value ... to data type int." It's not an int!

mohassan99_0-1653253989547.png

How do I find the cause of the second part of this error? 

How do I find out where it is trying to convert this to an int and stop it from doing so?

This column is not an int in PBI. If it's a SQL Server problem, why is the view created without any errors in SQL Server?

Why is this particular value in a varchar column being converted to an int?

The view is a union query. The value of concern is in the 'measure' column. That column is varchar is all the tables in the unions. In PBI desktop's data view the column is 'text'. 

 

 

 

mohassan99_0-1653270498185.png

 

mohassan99_1-1653270555294.png

 

2 REPLIES 2
ebeery
Memorable Member
Memorable Member

@Anonymous in order to further debug this, I would recommend opening up Power Query ("Transform Data"), navigating to the table/query in question, and walking back through each step to verify where the error occurred.

Verify what the data type of 'Comprehensive Diabetes Care - HbA1c Poor Control (>9.0%)' is, and whether the query is attempting to perform any conversions or transformations on this column, since that appears to be what is triggering this error.

Anonymous
Not applicable

Is this what you mean?

mohassan99_0-1653270353592.png

 

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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