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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymoussss
Regular Visitor

ODBC problem in loading data

Hi,
Got this error

Expression.Error: Data source error occurred.
SQLSTATE: 22018
NativeError: 0
Error message: ODBC: ERROR [22018] [MongoDB][API] invalid character value for cast to type: Bit

I use MongoDB Atlas SQL connector to get the data. MongoDB ODBC is being used.
The column is of type true/false. there is no error in data(Also no null values). The problem occurs exactly at the 1006th column(the table has around 1300 columns). If i remove this particular column, then the complete table with all the rows load. I tried changing the type of the column to text but same error persists.

Whats the problem and how do I solve it.

1 ACCEPTED SOLUTION
v-vpabbu
Community Support
Community Support

Hi @Anonymoussss,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

I would suggest considering the following approach to resolve the issue

  • Instead of loading the entire dataset at once, try excluding the problematic column initially. Once the rest of the data is loaded, add the column separately and check if the issue persists.
  • If possible, use the native MongoDB connector in Power BI instead of ODBC. The native connector is optimized for MongoDB and may handle Boolean values more effectively, avoiding the casting error.


If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!


Regards,
Vinay Pabbu

View solution in original post

7 REPLIES 7
v-vpabbu
Community Support
Community Support

Hi @Anonymoussss,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

Hi @Anonymoussss,

 

May I ask if you have gotten this issue resolved?

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

Regards,
Vinay Pabbu

Hi @Anonymoussss,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

v-vpabbu
Community Support
Community Support

Hi @Anonymoussss,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

I would suggest considering the following approach to resolve the issue

  • Instead of loading the entire dataset at once, try excluding the problematic column initially. Once the rest of the data is loaded, add the column separately and check if the issue persists.
  • If possible, use the native MongoDB connector in Power BI instead of ODBC. The native connector is optimized for MongoDB and may handle Boolean values more effectively, avoiding the casting error.


If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!


Regards,
Vinay Pabbu

AnkitKukreja
Super User
Super User

Hi! @Anonymoussss 

 

When you say this column, what datatype does it have in source and which datatype are you using in PBI?
Try to convert that column at the source level. The datatype conversion within the query itself should help . Also, try calling that one column and see if that works or not, this way you can narrow down the problem.

 

If this doesn't solve your problem you can raise a ticket - If you have a Pro license you can open a Pro ticket at https://admin.powerplatform.microsoft.com/newsupportticket/powerbi
Otherwise you can raise an issue at https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues.

 

 

 

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Hi @AnkitKukreja 

I think the problem is with the MongoDB atlas sql connector. I've tried loading that particular column separately and the error raises. If I ommit that column, then other columns load. The data is getting loaded if I download and use but I need latest data so I use import mode and refresh the data as using direct query does not support some transformation steps.

Thank You.

Hi @Anonymoussss,

 

Since the issue is with the MongoDB Atlas SQL Connector, and the error occurs when loading just that column, the problem is likely due to how the ODBC driver handles Boolean values.

 

Some ODBC drivers struggle to interpret Boolean data types correctly, leading to type mismatch errors.

 

Try converting the column at the source level before it reaches Power BI.

 

Regards,

Vinay Pabbu

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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