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
RobindeKater
Regular Visitor

Year is not recognized in DATEADD (and other formulas)

Hi all,

 

Can anybody tell me where this error is coming from?

 

Test = DATEADD(DimPeriode[Datum], 1, year)
Gives this error:
The syntax of 'year' is incorrect.
 

I've tried everything ; in stead of , jaar (that's dutch) in stead of year, years in stead of year, month in stead of year etc. etc. I'm using version Version: 2.70.5494.761 64-bit (June 2019), regional settings are 'English (Nederlands)'.

 

Hope to hear from you,

 

Robin

 

P.S. same error here:
2019-06-26 14_55_02-Basis rapport Beter Horen - Power BI Desktop.png

1 ACCEPTED SOLUTION

I've found the solution to the problem. Although it is nowhere to be mentioned, you should have a leading space before the comma.

Test = date(2012,7,8) gives an error

Test = date(2012 ,7 ,8) doesn't.

 

To be honest I think this is a bug. It is not mentioned in the official microsoft tutorial:

2019-07-05 15_44_47-DATE function (DAX) - DAX _ Microsoft Docs.png

View solution in original post

6 REPLIES 6
v-frfei-msft
Community Support
Community Support

Hi @RobindeKater ,

 

We can update your formula like this. Please have a try 🙂

 

Verkopen12 = calculate (
[Anatal TST],FILTER(ALL(DimPeriode),
AND(DimPeriode[Datum]<= MAX(DimPeriode[Datum]),
DATE(YEAR(DimPeriode[Datum])+1,MONTH(DimPeriode[Datum]),DAY(DimPeriode[Datum]))>MAX(DimPeriode[Datum])
)
)
)
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Frank,

2019-06-27 14_38_39-Basis rapport Beter Horen - Power BI Desktop.png

It must be something locally on my computer. Now an error appairs at the month-part of the date-formula.

 

Hi @RobindeKater ,

 

Did you use Import or direct query? Is that possible to share your sample data to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft  Frank,

 

Did you find anything to help me?

 

Robin

I've found the solution to the problem. Although it is nowhere to be mentioned, you should have a leading space before the comma.

Test = date(2012,7,8) gives an error

Test = date(2012 ,7 ,8) doesn't.

 

To be honest I think this is a bug. It is not mentioned in the official microsoft tutorial:

2019-07-05 15_44_47-DATE function (DAX) - DAX _ Microsoft Docs.png

Hi Frank,

 

This is the link to the file:

https://1drv.ms/u/s!AvIL2Vb5RRlvm1udUF1MaqXtJHCV?e=2B6WWJ

 

Thanks!

 

Robin

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.