3 Replies Latest reply on Aug 2, 2018 10:14 AM by Andrew Bickert

# How to recognise last day of data and display is as a filter

Hello,

I have a dashboard wich I just want to display last day of data available as a filter,

Problem is 'yesteday day' is not always available and sometimes the gap is two or three days,

How can I be able to identify automatically last day of data available and display just that day in filters?

*I want to select just last day of data in my filters independent when it is,

Thanks!

• ###### 1. Re: How to recognise last day of data and display is as a filter

Hi Jordi,

You should be able to do a calculation for the max([date]) to get the latest date of data and then use this to create a calculation to check if the [date]  is equal to that last date. Put this in your filter as TRUE so that the latest date will show up.

In this example I am using a LOD expression to get the max date and then applying it back to the date Dimesion:

[Date]={ FIXED [Number of Records]:MAX([Date])}

Andrew

• ###### 2. Re: How to recognise last day of data and display is as a filter

Hello Andrew Bickert

Do you think I can mix this true/false filter with 'normal' date filter?

Because of course by default I want last day available of data but then I want let my users to check other days,

Let me know, thanks!

• ###### 3. Re: How to recognise last day of data and display is as a filter

HI Jordi,

That is a little trickier. You can use a parameter to have the user choose the date, the issue will be to default the parameter to the latest date of data. To do this you can set the default date of the parameter and write a calculation that says, is the parameter the default if yes than do max date if no then get the date on the parameter. In this example I am using January 1, 2018 as the default and then allowing a user to choose another date.

IF [Date (Default 1/1/2018)]=#1/1/2018# then

[Date]={ FIXED [Number of Records]:MAX([Date])}

ELSE
[Date] = DATE([Date (Default 1/1/2018)])

END

This would then be set to TRUE in the Filters. When you publish out to the server, leave the default date so the date parameter will always show the max(date) in your data set. If the user wants a different date they can change the date parameter.

Andrew