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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Quiny_Harl
Advocate III
Advocate III

"Conversion failed when converting the varchar value to data type int" error when add custom column

Hello folks,

 

I need to create a composite key column by combining several columns:

Quiny_Harl_1-1635851280712.png

 

However, I get the following error message: 

"DataSource.Error: Microsoft SQL: Conversion failed when converting the varchar value '|' to data type int."

I suppose the reason for this is because some of the columns are of a type int and some are of a type text and those that are of type int need to be converted to text. However, for the purpose of query folding, I'm not allowed to change the column type (or at least this is what the documentation says). Is there any workaround for this?

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can wrap the non-text columns with Text.From in your expression.  If that won't fold, you could always make your column with a DAX expression after the table is loaded.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

You can wrap the non-text columns with Text.From in your expression.  If that won't fold, you could always make your column with a DAX expression after the table is loaded.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors