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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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