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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Token then expected error

I am experiencing a token then expected error for the following code with the first AND underlined in red:

if [rev] <1 then "Stopped"
else if [rev] >= 1 AND [rev] <= 100000 then "Below $100K"
else if [rev] > 100000 AND [rev] <= 500000 then "Between $100K and $500K"
else if [rev] > 500000 AND [rev] <= 1000000 then "Between $500K and $1M"
else if [rev] > 1000000 AND [rev] <= 5000000 then "Between $1M and $5M"
else "More than $5M"

 

how can i get rid of this error? 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try writing all the "AND"s in lowercase as "and".

M language is entirely case-sensitive, so this is probably the issue.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @BA_Pete ! That solved my issue 🙂

BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Try writing all the "AND"s in lowercase as "and".

M language is entirely case-sensitive, so this is probably the issue.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors