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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
tgfauzan9303
Regular Visitor

Query Error

Hi, goood day all , i creates some new query in power BI, but it show error message "TOken Literal Expected " on AND statement.  Does anyone can provide me a solution for this. SWITCH (wrhwr_eot_overdue[status_generated] = '1' AND (wrhwr_eot_overdue[status_open] ='1' AND (wrhwr_eot_overdue[status_complete]='1' AND (wrhwr_eot_overdue[status_overdue]='1' AND (wrhwr_eot_overdue[status_eot]='1' AND )))))
1 ACCEPTED SOLUTION

Hi @tgfauzan9303

 

Power Query doesn't have switch function, you can use DAX Switch() function instead. 

If you want to create a custom column in Query Editor use Power Query, you can use If... then... else... or use custom function, see: https://www.excelguru.ca/blog/2014/09/03/multi-condition-logic-in-power-query/

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @tgfauzan9303

 

It looks like the issue happens in Power BI desktop, right? 

 

Would you please clarify the detail steps that you are taking cause the issue? It would be better if you could provide some screenshots. Do mask sensitive information in screenshots before uploading here.  

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I add custom column as below

 

Edit Query -> Add customn column 

 

1.jpg

 

 

Hi @tgfauzan9303

 

Power Query doesn't have switch function, you can use DAX Switch() function instead. 

If you want to create a custom column in Query Editor use Power Query, you can use If... then... else... or use custom function, see: https://www.excelguru.ca/blog/2014/09/03/multi-condition-logic-in-power-query/

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Qiuyun Yu

Thanks for the information. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.