Nested IF Function in Looker

Hello, I have tried to find how to do this by searching the forum, but I have not had any luck.

I am trying to convert this nested IF function that works in Excel, to Looker. 

=IF([@[Winning Bid]]<101,"I",IF([@[Winning Bid]]<500,"II",IF([@[Winning Bid]]<700,"III",IF([@[Winning Bid]]<1000,"IV",IF([@[Winning Bid]]<2000,"V",IF([@[Winning Bid]]<3000,"VI",IF([@[Winning Bid]]>3000,"VII")))))))

I am trying to create categories based on the value of a certain product. For example, if an item sold for less than $101, it would be category I. If an item sold for $1,500, it would be category V.

 

0 2 1,347
2 REPLIES 2

@TrevorTrex ,

You can try with a CASE WHEN statement, like in SQL. It is more readable. (assignment of the first condition met)

CASE
WHEN [Winning Bid] < 101 THEN "I"
WHEN [Winning Bid] < 500 THEN "II"
...
END

 

Thank you!