Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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!
Solved! Go to Solution.
If you merely remove the "number" and the parentheses everywhere, it will work!
--Nate
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
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
If you merely remove the "number" and the parentheses everywhere, it will work!
--Nate
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...?
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
7 | |
6 | |
5 |