2
votes

Is there a way to reference the date range defined in the date filter?

Let's say I assign a date filter 2017-05-01 till 2017-05-31. Then I create a calculated field which highly depends on the range. For example:

ELSEIF [min_date] >= Range Start Date and [min_date] <= Range End Date THEN 1

I want the calculated field adjust depending on the date filter set up.

1

1 Answers

2
votes

You can't access the filter settings.

You can instead define one or more parameters, say a [Start Date] and [End Date] pair, or a [Start Date] and [Number of Days]. Parameters are visible from calculated fields.

If you want to use the parameters to control filtering, you'll have to define a calculated field to place on the filter shelf -- something like:

[Date] >= [Start Date] and [Date] <= date_add('day', [Start Date], [Number of Days])

This approach has a couple of advantages in return for the slight amount of extra work.

  • The parameters are visible to calculated fields so you can use them as desired.
  • Parameters are scoped to the workbook, not tied to a data source. So they are visible to all the data sources used by the workbook. This means you can use parameters to control filter settings and other calculations in many data sources at once.