6 Replies Latest reply on Aug 23, 2018 12:11 AM by Ajith Suresh

# Need to find last date data for the applied filter (year, quarter & month)

I am having a requirement like when ever user selects a particular month, quarter or year, we have to display the last date data for the corresponding date selections.

Initially we have created a calculated field to find the last date data for current month but which is not filter friendly hence it is showing data with respect to today's date. The main requirement is to write a calculation which is filter friendly so that user will be able to see last date data for current month, previous month and so on for all the date filter selections.

I am attaching a demo workbook created with Tableau 10.1. In the workbook, i have included the calculation for last date data which is not filter friendly.

Ajith V S

• ###### 1. Re: Need to find last date data for the applied filter (year, quarter & month)

Ajith,

Make your all 3 year/quarter/month filters as context filters  and create below calculated field.

[Ship Date]={max([Ship Date])}

Put it on filter shelf and choose TRUE.

• ###### 2. Re: Need to find last date data for the applied filter (year, quarter & month)

Hi, Ajith

Please find my solution below. I don't have lower version than 10.2, so I can't provide the updated workbook, but if you have question, please let me know

Hope this helps

ZZ

• ###### 3. Re: Need to find last date data for the applied filter (year, quarter & month)

Hi,

Find my approach below,

Sales Last Date:

SUM( IF [Ship Date] = {FIXED [Customer Name]:MAX([Ship Date])} THEN

[Sales]

END)

Let us know if this help

Mahfooj

• ###### 4. Re: Need to find last date data for the applied filter (year, quarter & month)

Hi,

This has helped me to find the last date data for the applied filter.

Thank you very much for the information.

I have one more query on this, is it possible to find MTD, QTD & YTD in the same chart using this solution?

ie, if the applied filters are year=2018, month=july then,

MTD = complete data for july month

QTD = Q3 data

YTD= 2018 data till july

If yes, could you guys help on this too.

Thanks,

Ajith V S.

• ###### 5. Re: Need to find last date data for the applied filter (year, quarter & month)

Hi, Ajith

In this case, I will recommend to use date parameter instead of filter to achieve that. Please confirm whether parameter is good to go or not.

ZZ

• ###### 6. Re: Need to find last date data for the applied filter (year, quarter & month)

Thanks for the Info.

We have created those calculations by creating parameters.

Please let me know if there is a possibilty of creating qtd,mtd & ytd calculations by using tableau available functions which is filter friendly.