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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
watkinnc
Super User
Super User

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

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

watkinnc
Super User
Super User

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


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

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


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
watkinnc
Super User
Super User

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

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors