The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.