Day 12 - to, each, for
We are exactly halfway through the #ThoughtSpotAdventCalendar. Door number 12 hides the last section dedicated to dates. Without hesitation, let's proceed to see what exactly is hidden here?and what secrets ThoughtSpot still has in store for you.
You have probably noticed in the previous sections that sometimes the line chart consists of a continuous line and sometimes it is partly a dotted line.
The explanation is very simple. The solid line are months that are already in the past and the dotted line are dates from the future. It is clear that we may need to carry out an analysis of the data, which will present dates that correspond to each other. This could be an analysis of two years to the same date or several months but for the same number of days for each month. You have probably used YTD (year-to-date) most often.
As you can guess, when analysing #data with the #SpeedOfThought, no one will be telling you to mark the exact dates or construct special expressions. The solution is relevant keywords. Look at the example in which we do a monthly analysis but for as many days as the current month indicates. The keywords used is month to date.
In other words, we have checked that we have 12th of December and our analysis is a comparison for each month of sales from the days 01 to 12. You can use different versions of this expression - year to date, month to date or week to date.
Another keyword we will add to the date operations is the keyword each. The best way to understand is to look at an example in which we count sales but for the last three days of each week. In other words, you take the last three days of each week and add the sales for those days.
领英推荐
In the second part you have a demonstration of how to count the total of the last day of each month.
The last keyword that will complete your knowledge about dates is the keyword of. You use it when you want to use for grouping the day number of the week/month/quarter/year, the week number of the month/quarter/year, etc.
When using month of quarter the possible values are 1, 2 and 3. When using week of month you can get 1, 2, 3, 4 or 5. As I have written before, you can use different combinations.
Today we are completing a certain closed whole. I can already reveal that something different from the dates awaits you at tomorrow's door.