Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello all,
Can someone please help me convert this to power query? I keep getting the token literal expected error. I have googled everywhere and cannot figure the result out. I really appreciate any help! Thanks in advance!
IF((OR([Evaluation Status]='Reviewed',[Evaluation Status]='Finalized')*AND([Days Past POP End Date]>=121))'Delinquent',IF(AND([Evaluation Status]='Rated',[Days Past POP End Date]>=91),'Very Late',IF((OR([Evaluation Status]='Initiated',[Evaluation Status]='Drafted'))*AND[Days Past POP End Date]>=31)),'Late','NA')))
Solved! Go to Solution.
Hi @ca-traveler - when you add a column Power Query, you need to use the following syntax for nest if with or + and conditions:
if ( [ColumnName1] = "text1" or [ColumnName1] = "text" )
and [ColumnName2] >= 121
then "Result1" else
if [ColumnName1] = "text3"
and [ColumnName2] >= 91
then "Result2" else
"N/A"
Here is a good resource to learn more: IF Statements in Power Query M (Incl Nested IFs, OR, AND) (gorilla.bi)
Hi @ca-traveler ,
Does this seem to be about right? 🙂
Here the M code for the query:
if ( [Evaluation Status] = "Reviewed" or [Evaluation Status] = "Finalized" ) and [Days Past POP End Date] >= 121 then "Delinquent"
else if [Evaluation Status] = "Rated" and [Days Past POP End Date] >= 91 then "Very Late" else if ( [Evaluation Status] = "Initiated" or [Evaluation Status] = "Drafted" ) and [Days Past POP End Date] >= 31 then "Late" else "NA"
Let me know if this helps 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Hi @ca-traveler ,
Does this seem to be about right? 🙂
Here the M code for the query:
if ( [Evaluation Status] = "Reviewed" or [Evaluation Status] = "Finalized" ) and [Days Past POP End Date] >= 121 then "Delinquent"
else if [Evaluation Status] = "Rated" and [Days Past POP End Date] >= 91 then "Very Late" else if ( [Evaluation Status] = "Initiated" or [Evaluation Status] = "Drafted" ) and [Days Past POP End Date] >= 31 then "Late" else "NA"
Let me know if this helps 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Awesome, thanks Tom! 🙂
Hi @ca-traveler - when you add a column Power Query, you need to use the following syntax for nest if with or + and conditions:
if ( [ColumnName1] = "text1" or [ColumnName1] = "text" )
and [ColumnName2] >= 121
then "Result1" else
if [ColumnName1] = "text3"
and [ColumnName2] >= 91
then "Result2" else
"N/A"
Here is a good resource to learn more: IF Statements in Power Query M (Incl Nested IFs, OR, AND) (gorilla.bi)
Awesome, thanks Daryl!
Trent
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
6 | |
6 | |
5 | |
5 |
User | Count |
---|---|
9 | |
9 | |
8 | |
6 | |
6 |