Forum Discussion

HamidBee's avatar
HamidBee
Power Participant
4 years ago
Solved

What does '.[Date]' mean in the DAX function below?

I'm not sure what '.[Date]' means in the following expression.

 

PY Sales=CALCULATAE(SUM(Sales[Sales]),DATEADD('Calendar'[Date].[Date],-1,YEAR))

 

Any help would be appreciated.

  • When you don't have a custom date table and are using Power BI's built in dates for time intelligence, each date column automatically gets several fields associated with it so that you can access different date parts.

    'Calendar'[Date].[Year] would return the year portion of the date, for example.

    In the formula you show then the .[Date] portion is redundant as it will just return the same value as 'Calendar'[Date], so you could replace the formula with

    PY Sales=CALCULATE(SUM(Sales[Sales]),DATEADD('Calendar'[Date],-1,YEAR))

2 Replies

  • When you don't have a custom date table and are using Power BI's built in dates for time intelligence, each date column automatically gets several fields associated with it so that you can access different date parts.

    'Calendar'[Date].[Year] would return the year portion of the date, for example.

    In the formula you show then the .[Date] portion is redundant as it will just return the same value as 'Calendar'[Date], so you could replace the formula with

    PY Sales=CALCULATE(SUM(Sales[Sales]),DATEADD('Calendar'[Date],-1,YEAR))