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
j_w
Helper IV
Helper IV

Is date_start a reserved keyword in DAX?

When I use date_start as a variable in DAX I get following error:

image.png

 

But if I rename date_start to date_start2 or date_sta, it is fine.

 

So why there is an error when I use date_start?

 

Thanks

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @j_w,

 

By confirmed by PG, due to historical reasons, DAX parser started as an extension to MDX parser therefore automatically inherited all the MDX keywords. Since MDX parser was limited back in the old days, all MDX functions and metadata properties were added as keywords which unfortunately included DATE_START.

 

As a good coding convention, I recommend users to always prefix DAX variables with v or some other prefix the user prefers. So instead of DATE_START, the user could use vDateStart to make his code easy to read and maintain and also avoid accidental keyword collisions.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @j_w,

 

By confirmed by PG, due to historical reasons, DAX parser started as an extension to MDX parser therefore automatically inherited all the MDX keywords. Since MDX parser was limited back in the old days, all MDX functions and metadata properties were added as keywords which unfortunately included DATE_START.

 

As a good coding convention, I recommend users to always prefix DAX variables with v or some other prefix the user prefers. So instead of DATE_START, the user could use vDateStart to make his code easy to read and maintain and also avoid accidental keyword collisions.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @j_w,

 

I have had a contact with PG and will update here if I get any information.

 

Sorry for any inconvenience.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.