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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Haze1
New Member

IF Statement: Expressions that yield variant data-type cannot be used to define calculated columns.

Hello,

 

I am new to PowerBI and I more used to working with MS Excel. Can someone tell me why the following formula will not work?

 

Column = if (Sheet1[Profit]=0,"No Profit", (Sheet1[Profit]))

 

Thank you so much for your help! 🙂

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

You have two data types there, text and a number. You'll need to convert the number to text. The best way is using the FORMAT function. I'm guessing Profit is an amount of money, meaning a decimal number with two digits after the decimal, so that would be:

 

Column = if (Sheet1[Profit]=0,"No Profit", FORMAT(Sheet1[Profit], "Fixed"))

 

Or more generically...

 

 

Column = if (Sheet1[Profit]=0,"No Profit", FORMAT(Sheet1[Profit], "General Number"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
KHorseman
Community Champion
Community Champion

You have two data types there, text and a number. You'll need to convert the number to text. The best way is using the FORMAT function. I'm guessing Profit is an amount of money, meaning a decimal number with two digits after the decimal, so that would be:

 

Column = if (Sheet1[Profit]=0,"No Profit", FORMAT(Sheet1[Profit], "Fixed"))

 

Or more generically...

 

 

Column = if (Sheet1[Profit]=0,"No Profit", FORMAT(Sheet1[Profit], "General Number"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you so much for your help!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.