Parts, Names, and Truncs
There are a little trio of functions that could be very useful for anyone working with dates. These are DateTrunc DatePart and DateName.
These three functions all deal with extracting a particular detail or level of detail from any given date. DateTrunc() is the first of these and looks at removing detail from a particular date, for example using DateTrunc(‘week’ date) will give the start date for the week that the input date falls into, the start of the week is either specified in the formula or in the settings for the data source. DateTrunc is particularly useful for allowing or disallowing users to only go down to a certain level of detail when exploring date related data.
DatePart and DateName both work in similar ways; these allow you to access a particular discrete part of the date and to then use it. DatePart allows you to extract an integer value from the date and date name allows you to extract a string value instead. For example
I hope you have found this article useful follow out twitter feed @cloudstream_uk for more tableau tips, tutorials and news.