Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
bilalgunay
Contributor III
Contributor III

Selecting a date range based on another selection

Hi everyone,

I would like to get a range of dates selected (from a certain datefield in the data model) when some other selection is done in a filter pane.

For example filter pane has "Last 6 Months" and when selected this will go ahead and dynamically apply a filter to CalDate column something like CalDate >= 17/12/2021 and CalDate <= 17/06/2022 (in DD/MM/YYYY format)

How would you do this? The selection in the filter pane will be minimum like 2-3 of them, which will be via an Inline Table from script. They will be last 6, 9 and 12 months. I can write an (nested) If clause, if necessary.

Best,

Bilal

Labels (1)
1 Reply
rubenmarin

Hi, you can add a field the the filters table to add a number with the months, and use this number in set analysis, to filter CalDate it could be:

Sum({<CalDate={">=$(=AddMonths(Max(CalDate),-$(=NumMonthsFieldName)))<=$(=Max(CalDate))"}>} Sales)

Maybe needs some adjustments to add date format or in there are more than one filter selected