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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
CobbSalad
Regular Visitor

Custom Column Help

Hi y'all,

 

I am trying to create a custom column that will take the range of numbers from my column A and spit out a specific output. For example, everytime column A lists number between 1-10 I want the custom column to say "1-10". Or everytime column A lists a number between 10-25, I want the custom column to say "10-25", etc etc.

 

Here is the code I used when attempting to create the custom column:

if number([A])>0 and number([A])<11 then "1-10"
else if number([A])>10 and number([A])<26 then "10-25"
else if number[A]>25 and number[A]<51 then "25-50"
else if number[A]>50 and number[A]<76 then "51-75"
else if number[A]>75 and number[A]<100 then "76-99"
else if number[A]=100 then "100"
else if number[A]=0 then "0"
else "unknown"

 

I have received this error message:

Expression.Error: The name 'number' wasn't recognized. Make sure it's spelled correctly.

 

Any help would be much appreicated or any advice for doing this another way!

 

Thanks!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

If you merely remove the "number" and the parentheses everywhere, it will work!

--Nate

View solution in original post

Anonymous
Not applicable

You didn't ask, but your else if clauses could be more efficient; no need for "and":

if [A] = 100 then "100" else if [A] > 75 then "76-99" else if [A] > 50 then "51-75" else if [A] > 25 then "26-50" else if [A] > 10 then "10-25" else if [A] > 0 then "1-10" else if [A] = 0 then "0" else "Unknown"

 

--Nate

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

You didn't ask, but your else if clauses could be more efficient; no need for "and":

if [A] = 100 then "100" else if [A] > 75 then "76-99" else if [A] > 50 then "51-75" else if [A] > 25 then "26-50" else if [A] > 10 then "10-25" else if [A] > 0 then "1-10" else if [A] = 0 then "0" else "Unknown"

 

--Nate

Anonymous
Not applicable

If you merely remove the "number" and the parentheses everywhere, it will work!

--Nate

Watsky
Solution Sage
Solution Sage

Hey @CobbSalad , 

 

It seems to be working fine for me using :

=if [Number] > 0 and [Number] < 11 then "1-10" else if [Number] > 10 and [Number] < 26 then "11-25" else if [Number] > 25 and [Number] < 40 then "26-40" else "NO"

What are you listing the word number for in your code was it to say something along the lines of if this value is a number which is greater than 0...?

 

numbergroup1.png


Did my answer(s) help you? Give it a kudos by clicking the Thumbs Up! ?
Did my post answer your question(s)? Mark my post as a solution. This will help others find the solution.


Did my answer(s) help you? Give it a kudos by clicking the Thumbs Up!
Did my post answer your question(s)? Mark my post as a solution. This will help others find the solution.

Proud to be a Super User!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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