cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akhaliq7
Continued Contributor
Continued Contributor

Case statement in power query but with a greater than operator

Trying to implement the following in power query, I tried adding a conditional column but don't know how to get it to work with a greater than operator.

 

case

     when column1 >= 20

     and column1 <= 100

     and column2 = 'N' then 1

     else 0

end as column

1 ACCEPTED SOLUTION
akhaliq7
Continued Contributor
Continued Contributor

I got it to work:  Add column -> custom column, use the following formula:

if [column1] >= 20 and [column1] <= 100 and [column2] = "N" then 1 else 0

if column1 is a text datatype then you need to surround the value with double quotes

View solution in original post

1 REPLY 1
akhaliq7
Continued Contributor
Continued Contributor

I got it to work:  Add column -> custom column, use the following formula:

if [column1] >= 20 and [column1] <= 100 and [column2] = "N" then 1 else 0

if column1 is a text datatype then you need to surround the value with double quotes

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors
Top Kudoed Authors