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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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