Datetime Formatting


I’m trying to format dates for a visual in a specific way. The visual I’m using is a 100% stacked bar with dates in the x-axis.
Is it possible to format dates such that when the date is 2019 or 2021 the x-axis should show only the year: 2019, but when it’s other dates such as ‘2022-01-01’ it should show Jan 2022. I tried to do this in SQL, but it can only work in strings, I want to be able to use date data type. The x-axis should be as follow:
x - axis: 2019,2021, Jan 2022, Feb 2022, Mar 2022,…, and so on.

Please let me know if anyone knows how to achieve this…

Hi @Gent_Zhubi !

It sounds like you’re asking for two different levels of aggregation on single time line. Unfortunately, that’s not available. You’ll notice that you can customize the time aggregation by year, quarter, month, week, day, hour, minute or second, but only one at a time.

However, I believe that a drill down can achieve what you’re looking for. You’d start with the yearly aggregate and then have your users right click to see the data by month. You can see how to implement this here. There’s also an exercise in a workshop that you use here. And this post talks specifically about the date drill down, here.

Hope that helps!!