Forum Discussion

Belle2015's avatar
Belle2015
Helper II
1 year ago
Solved

Help with 'the syntax for 'PreviousDay' is incorrect' error

I am trying to use a measure to filter to show the previous day's data or the weekend's data on a Monday but I am getting the below error?     Any help would be greatly appreciated.  
  • lbendlin's avatar
    1 year ago

    PREVIOUSDAY happens to be the name of a DAX function.  Use a different name for your variable.

  • danextian's avatar
    1 year ago

    Hi Belle2015 

    Reserved words, such as function names, cannot be used as variable names. My typical approach is to prefix the variable name with an underscore (_), just in case a future function with the same name as an existing variable is created.

  • divyed's avatar
    1 year ago

    Hello Belle2015 ,

     

    PREVIOUSDAY is a DAX function and reserverd keyword in DAX. As per guideline we can not use existing reserved word or functions anywhere in dax code hence you see this error. Replace this variable with other names like VAR_PREVIOUS_DAY or _PREVIOUSDAY and run your code again.

     

    I hope this answers your query.

     

    Warm Regards,

    Neeraj Kumar