Here's how to show the recent/latest date as default and allows user to select the desired dates to compare.

 

To achieve this, we need to have this logic:

 

1. Create Rank on dates (descending)

2. Create a parameter (integer) to filter the rank - this will allow users to have flexibility to input the # of days to compare

 

Steps:

 

I. Draft the desired output, example:

Date1.JPG

2. FIELD NAME: Date Rank

 

Create Calculated Field and use Rank Function on Date field (shown below). The attr([DATE]) function below just selects the distinct DATES that we need to rank. Then make sure to set the Default Table Calculation (in red box below):

Date4.JPG

Choose the fields below for the Default Table Calculation:

Date5.JPG


3. PARAMETER NAME: # of Days to Compare

 

Create an Integer parameter.

Date6.JPG


4. FIELD NAME: Date - Show/Hide

 

Create a field that will filter the Date Rank based on our parameter (# of Days to Compare)

Date7.JPG

We now have all the required fields.

 

5. Lastly, we use all the newly created fields as filter:

 

     a. Use Date - Show/Hide, select Show.

     b. Show parameter control for # of Days to Compare. You can input the desired # of days to compare. Note that this parameter will also be the maximum number of days displayed.

Date8.JPG

6. Lastly, add Date Field as filter but make sure to select ALL VALUES as default. Then Show Quick Filter. By default, even if all values are selected, the data will only display the most recent 10 days because we assign 10 # of days to compare as parameter. Select the desired date to compare, just choose from the check box as shown in the Dates Quick Filter.

 

Date10.JPG

Here's a manual select:

 

Date11.JPG

 

Mark R.