Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

dot in date

Whenever I write a query involving some sort of date table data, I get 'Date'[Date].SOMETHING. I do know what 'Date'[Date] is, but what exactly is that DOT stuff? What does it signify? How is 'Date'[Date].[Date] different from 'Date'[Date].[Day] or 'Date'[Date].[Year] ??

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    The Dot indiciates how you want to format or extract from that data.

     

    So 'Table'[Field].Date would get you the Date value out of the field (which might have a Date and Time value).

    'Table'[Field].Day would get you the Day value out of a field (which might have a Date or Date and Time). 

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Anonymous,

     



    Whenever I write a query involving some sort of date table data, I get 'Date'[Date].SOMETHING. I do know what 'Date'[Date] is, but what exactly is that DOT stuff?  

    'Date'[Date].SOMETHING is aimed to fetch the day/month/year/quarter part from the date formatted field. For example, if we have one date value '7/1/2017'

    'Date'[Date].[Day]=1

    'Date'[Date].[Year]=2017

    'Date'[Date].[Date]=7/1/2017

    'Date'[Date]=7/1/2017

     


     How is 'Date'[Date].[Date] different from 'Date'[Date].[Day] or 'Date'[Date].[Year] ??

    From above example, we can see that 'Date'[Date].[Date] and 'Date'[Date] return the same result, but if you want to use DateAdd function for noncontinuous date, you have to use 'Date'[Date].[Date], because 'Date'[Date] will return blank. Please see below:

    DataAdd date = DATEADD('Date'[Date],1,DAY)

    DataAdd date.date = DATEADD('Date'[Date].[Date],1,DAY)

     

    Best regards,
    Yuliana Gu