Forum Discussion

TPGDIMO's avatar
TPGDIMO
New Member
3 years ago
Solved

Token Eof expected error

i wrote simple nested if statement in power query  editor.   it gives Token Eof expected error in highlighted possition. What is the reason   IF [Date.last.editted] > "01/04/2022" then "2022/2023...
  • m13eam's avatar
    3 years ago

    Hi - M/PowerQuery is case-sensitive, so it doesn't recognise "IF". Hopefully the below should work

     

    if [Date.last.editted] > "01/04/2022" then "2022/2023"
    
    else
    if [Date.last.editted] > "01/04/2021" then "2021/2022"
    else
    if [Date.last.editted] > "01/04/2020" then "2020/2021"
    else
    if [Date.last.editted] > "01/04/2019" then "2019/2020"
    else
    if [Date.last.editted] > "01/04/2018" then "2018/2019"
    else "2017/2018"

     

    I hope that helps!