cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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

Accepted Solutions
Highlighted
Memorable Member
Memorable Member

Re: have a cRe: IF statement comparing number and text

hi @DaisySara - 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!

View solution in original post

5 REPLIES 5
Highlighted
Super User I
Super User I

Re: IF statement comparing number and text

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.




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

Proud to be a Super User!




Highlighted
Helper III
Helper III

have a cRe: IF statement comparing number and text

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")

 

Highlighted
Memorable Member
Memorable Member

Re: have a cRe: IF statement comparing number and text

hi @DaisySara - 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!

View solution in original post

Highlighted
Resolver I
Resolver I

Re: IF statement comparing number and text

@DaisySara 

 

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

Re: have a cRe: IF statement comparing number and text

Thank you, worked!!

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors