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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Super User
Super User

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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.