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
Nolonwabo
New Member

The syntax for 'month' is incorrect.

When I add a new measure 

Prev_Month_Orders = CALCULATE([Total_Orders], dateadd(AW_Calender_Lookup[Date], -1, month))
I get an error The syntax for 'month' is incorrect. (DAX(CALCULATE([Total_Orders], dateadd(AW_Calender_Lookup[Date], -1. month)))).
 
Please help.
My regional setting is English(United States)
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Nolonwabo 

 

Based on your description, I created data to reproduce your scenario.

Test:

d1.png

 

Calendar:

 

Calendar = CALENDARAUTO()

 

 

There is a one-to-one relationship between two tables.

 

You may create a measure as follows.

 

Pre_Month_Sales = 
CALCULATE(
    SUM(Test[Sales]),
    DATEADD('Calendar'[Date],-1,MONTH)
)

 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Nolonwabo 

 

Based on your description, I created data to reproduce your scenario.

Test:

d1.png

 

Calendar:

 

Calendar = CALENDARAUTO()

 

 

There is a one-to-one relationship between two tables.

 

You may create a measure as follows.

 

Pre_Month_Sales = 
CALCULATE(
    SUM(Test[Sales]),
    DATEADD('Calendar'[Date],-1,MONTH)
)

 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mussaenda
Super User
Super User

it has something to do with "," and "."

Try what @Greg_Deckler  is suggesting

Greg_Deckler
Community Champion
Community Champion

Are you certain you should not be using ; instead of , Depends on the language setttings. Seems weird, the DAX error is treating the , as a . so I'm guess ; is the way to go.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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