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
juhoneyighot
Helper III
Helper III

Expressions that yield variant data-type cannot be used to define calculated columns

Hi! I'm new to PowerBI.

I'm using the IF statement, unfortunately I'm getting this error "Expressions that yield variant data-type cannot be used to define calculated columns."

Calculated Column: IF('stx__legacy_fsjob'[NC.IN]="","",(LEN('stx__legacy_fsjob'[_JobType_txt])-(LEN(SUBSTITUTE('stx__legacy_fsjob'[_JobType_txt],"_","")))))

 

Can anyone help me on this.

Thank you.

1 ACCEPTED SOLUTION

It works. Thank you.

View solution in original post

2 REPLIES 2
SamInogic
Super User
Super User

Hi @juhoneyighot 

You can try below DAX expression,

IF('stx__legacy_fsjob'[NC.IN]="","",CONVERT((LEN('stx__legacy_fsjob'[_JobType_txt])-(LEN(SUBSTITUTE('stx__legacy_fsjob'[_JobType_txt],"_","")))),STRING))


The issue was your expression have true part as blank string value and false part returning length which is numeric data type so we need to have both values of same type.

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

It works. Thank you.

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.