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 custom column

Hi guys,

 

I'm trying to create a new column where the output value is dependent on the numerical value in a different column. This is create a slicer that allow the user to choose between grouped ranges of values.

 

The query is as follows:

 

if [Score] <= 0.2499 then "Info"
else if [Score] >= 0.25 if [score]
else if [Score] >= 0.50 & [Score] <= 0.7499 then "Medium"
else if [Score] >= 0.75 & [Score] <= 0.899 then "High" else "Critical"

 

When this custom column is computed, the first line works (there are rows returning the 'info' value), however the output for the rest of the rows is an error.

 

an example of the error statement:

 

Expression.Error: We cannot apply operator & to types Number and Number.
Details:
Operator=&
Left=0.25
Right=0.454

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Nevermind, I fixed it; just got to replace '&' with 'and'

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@Anonymous 

Good, remember AND operator is (&&) not just (&), and OR operator is (||).

 

Paul Zheng _ Community Support Team

Anonymous
Not applicable

Nevermind, I fixed it; just got to replace '&' with 'and'

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.

Top Solution Authors
Top Kudoed Authors