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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
acg
Resolver I
Resolver I

New column needed based on : if column > x and column <y then "zz"

I tried to create a new column based on a if > and < then. 

I am trying to create a new Custom column.

I don't understand why this does not work. It is asking for a token on the second Answer Numeric Value statement. 

what is missing?

 

Bucket S=

[Answer Numeric Value] >= 0 && [Answer Numeric Value] <= 4999 , "$1 - $4,999",
[Answer Numeric Value] >= 5000 && [Answer Numeric Value] <= 9999 , "$5,000 - $9,999",
[Answer Numeric Value] >= 10000 && [Answer Numeric Value] <= 24999,"$10,000 - $24,999",
[Answer Numeric Value] >= 25000 && [Answer Numeric Value] <= 49999,'$25,000 - $49,999',
[Answer Numeric Value] >= 50000 && [Answer Numeric Value] <= 99999, "$50,000 - $99,999",
[Answer Numeric Value] >= 100000 && [Answer Numeric Value] <= 499999, "$100,000 - $499,999",
[Answer Numeric Value] >= 500000, "$500,000 +"

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@acg , Try like

 

Bucket S=Switch(True(),

[Answer Numeric Value] <= 4999 , "$1 - $4,999",
[Answer Numeric Value] <= 9999 , "$5,000 - $9,999",
[Answer Numeric Value] <= 24999,"$10,000 - $24,999",
[Answer Numeric Value] <= 49999,'$25,000 - $49,999',
[Answer Numeric Value] <= 99999, "$50,000 - $99,999",
[Answer Numeric Value] <= 499999, "$100,000 - $499,999",
[Answer Numeric Value] >= 500000, "$500,000 +"
)

View solution in original post

3 REPLIES 3
acg
Resolver I
Resolver I

It works, as long as it is used uner Fields, and a new column is created in Fields. Thank you! Fantastic

acg
Resolver I
Resolver I

hmm, does not work as Switch(True(), seems to want a calculated field and Answer Numeric Value is a column. Also, how can the calculation be true as half of the conditins were left out?  I mean this [Answer Numeric Value] <= 9999 , "$5,000 - $9,999" would make [this Answer Numeric Value] <= 4999 , "$1 - $4,999" irrelevant? right?

amitchandak
Super User
Super User

@acg , Try like

 

Bucket S=Switch(True(),

[Answer Numeric Value] <= 4999 , "$1 - $4,999",
[Answer Numeric Value] <= 9999 , "$5,000 - $9,999",
[Answer Numeric Value] <= 24999,"$10,000 - $24,999",
[Answer Numeric Value] <= 49999,'$25,000 - $49,999',
[Answer Numeric Value] <= 99999, "$50,000 - $99,999",
[Answer Numeric Value] <= 499999, "$100,000 - $499,999",
[Answer Numeric Value] >= 500000, "$500,000 +"
)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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