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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

IF statement comparing number and text

I want to create an IF statement that says if the value is greater than 90, then excellent, if it's 80-90, then good...etc.  But keep getting error can't compare numbers and text.  How can I do this?

1 ACCEPTED SOLUTION

hi @Anonymous - Follow the below steps to compare a %age value and assign a corresponding value 

1. You would need to create a calculated column as below: 

Check = IF ([%age] > 0.9, "Excellent!!", IF ( [%age] <= 0.9 && [%age] > 0.8 , "Good!!", "Better luck next time!!"))
Note: Ensure that the "%age" column is formatted as a numeric or %age column 

Sumanth_23_0-1600975055408.png

 

 Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

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

Proud to be a Super User!



View solution in original post

5 REPLIES 5
lit2018pbi
Resolver II
Resolver II

@Anonymous 

 

I am able to compare a number and text.
 
Column = IF('Table'[Percentage] >= 88.5, "Excellent", "Bad")
if st.PNG
 
vanessafvg
Super User
Super User

you will not be able to compare numbers and text, they are different data types. You will need to convert one of them. Can you you post your if statement please.

Also can you share a screenshot of your data.




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

I have a calcuated field with a percentage, and I need to say if it is above this percentage, then assign them a status.  I don't see how I can convert say a percentage of 88.5% into a string and say if it is greater than 88.5 then.....Less than and greater than won't work with a string will it?

 

Compliance Status = IF(CONVERT([Overall Compliance], string)>"80" , "Excellent", "BOOOOOOOO")

 

hi @Anonymous - Follow the below steps to compare a %age value and assign a corresponding value 

1. You would need to create a calculated column as below: 

Check = IF ([%age] > 0.9, "Excellent!!", IF ( [%age] <= 0.9 && [%age] > 0.8 , "Good!!", "Better luck next time!!"))
Note: Ensure that the "%age" column is formatted as a numeric or %age column 

Sumanth_23_0-1600975055408.png

 

 Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

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

Proud to be a Super User!



Anonymous
Not applicable

Thank you, worked!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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