How to create different time periods in Tableau? How do I create two time periods using a formula in Tableau?
- Tableau FAQs
- December 12, 2018
Tableau has many functions that you can use to work with dates. So, for example, the MONTH () function displays the month number from the date without considering the year, the YEAR () function displays the year, the WEEK () function displays the week number, etc.
Here are some examples:
You can also use the DATETRUNC () function to display the beginning of the month (as an example); this is useful when you need to display the month in date format:
DATE(DATETRUNC('month', [Modified Date]))
DATE( – Since the data in the Modified Date field is stored in Datetime format, we need to convert the function result to Date format, for this, we use the DATE () formatting function
DATETRUNC(‘month‘, – this is a required argument, here we specify the details of the data. In our case, it is Month, but it can also be Year or Day.
[Modified Date]) – this is also a required argument, and here we indicate the field based on which we will do the calculations of the date