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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Belle2015
Helper II
Helper II

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?

 

Belle2015_0-1738417207446.png

 

Any help would be greatly appreciated.

 

3 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

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

View solution in original post

danextian
Super User
Super User

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.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

divyed
Super User
Super User

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

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/

View solution in original post

3 REPLIES 3
divyed
Super User
Super User

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

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
danextian
Super User
Super User

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.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
lbendlin
Super User
Super User

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.