Forum Discussion
dirkjs
7 years agoFrequent Visitor
Incorrect syntax for DATETIME
I get an incorrect syntax error for the DATETIME strings in the example below:
CustomFiscalPeriods =
DATATABLE (
"Fiscal YearNumber", INTEGER,
"FirstDayOfYear", DATETIME,
"LastDayOfYear", DATETIME,
{
{ 2016, "28-06-2015", "2016-07-02" },
{ 2017, "2016-07-03", "2017-07-01" },
{ 2018, "2017-07-02", "2018-06-30" },
{ 2019, "2018-07-01", "2019-06-29" }
}
)
The syntax for "2015-08-16" is invalid.
I tested with Power-BI versions of June and May as well what gives the same error message!
My Input method is:
English (United States) and Belgian (Period) keyboard.
11 Replies
- pbeyeResolver II
I don't see "2015-08-16" in your formula, but I see "28-06-2015". Maybe that's the one causing the issue? Actually, when I test it out on my desktop both of those work for me. I'm using the July 2019 version.
Maybe try adjusting it to match the other dates formats to see if that works.
- v-lili6-msftCommunity Support
hi, dirkjs
If it is the format error as below:
CustomFiscalPeriods = DATATABLE ( "Fiscal YearNumber", INTEGER, "FirstDayOfYear", DATETIME, "LastDayOfYear", DATETIME, { { 2016, "28-06-2015", "2016-07-02" }, { 2017, "2016-07-03", "2017-07-01" }, { 2018, "2017-07-02", "2018-06-30" }, { 2019, "2018-07-01", "2019-06-29" } } )Please adjust it as below, then it should work well.
Table = DATATABLE ( "Fiscal YearNumber", INTEGER, "FirstDayOfYear", DATETIME, "LastDayOfYear", DATETIME, { { 2016, "2015-06-28", "2016-07-02" }, { 2017, "2016-07-03", "2017-07-01" }, { 2018, "2017-07-02", "2018-06-30" }, { 2019, "2018-07-01", "2019-06-29" } } )Result:
Best Regards,
Lin