Sort by Month and Year

Hi @shiva2gandluri
You could create a calculated field that concatenates the year and month as numbers, and sort by that.
For example, a calculated field might look like:
parseInt(concat(toString(extract('YYYY', TimeStamp)), ifelse(strlen(toString(extract('MM', TimeStamp))) = 1, concat('0', toString(extract('MM', TimeStamp))), toString(extract('MM', TimeStamp)))))
This gives you a format of 202212, 202301 etc.
You can add this to your pivot table, and then sort by it. Since you don’t want to see it you can also hide it and you will still be able to sort on it.
You need to add it in the right place in the rows section in order for it to work, so you could add it before department to always sort by date first, or after department so you will see department and then sorted by date. If you add it after your MonthAndYear field the sort won’t have any effect. Here I am grouping by department and sorting by date

2 Likes