How to use Nested IF in Power Query in Power BI?
First of all, you should be aware of the DAX syntax can't be used in Power Query, you can only use M Language to write formulas in Power Query in Power BI.
What's M language?
- M language is a mashup query language for Power Query.
- M language stands for Data Mashup or Data Modeling.
- M language is a functional, case-sensitive language similar to F#, which can be used with Power Query in Excel, Get & Transform in Excel 2016, and Power BI Desktop.
- M language can be only used in Power Query Editor in Power BI.
Note: M Language and DAX are supported by Power BI to manage, manipulate, filter, and analyze the data. but they are not the same and not dependent upon each other and each one has a different syntax, structure, and logic. Read more at Power BI: DAX Vs M Language
Using Nested IF in Power Query in Power BI
You can use the below syntax to build a Nested IF statement in Power Query in Power BI
if Condition 1 then "Result1"
else if condition 2 then "Result 2"
else if Condition3 then "Result 3"
else "Result4"
In your case, try to use the below statement to use the Nested IF statement in Power Query in Power BI without getting Token error like the following:
if [Start Date] > DateTime.Date then "Started" else if [End Date] <= DateTime.Date then "Finished" else "Not measured"
Read also Power BI: Custom Column Vs Calculated Column