Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
Not applicable

Dynamic filtering

Hello,

I started creating a dynamic dashboard. The first issue that Im facing is that i want to have a selectable time period for data submission and in turn recalculate all the visualizations to the 'current' state.

The first visualization I wanted to prepare this way is to calculate count of current active contracts for individual subscribers. Active contract is a contract that has been updated during the last 3 months (has available snapshots).

In my example it would be:

count (distinct (if(SnapshotDate>=addmonths(now(),-3), ContractCode)))

This gives me a measure I can use along with dimension SubscriberName, to see how many contracts are active right now.

I want to use similar measure for any selected time period through filtering SnapshotDate. If I select Jan - May 2015, I want to count all the contract with SnapshotDate >= addmonths ('2015-05-01',-3)

So far I found only this answer:

addmonths(

if(Left(GetFieldSelections(SnapshotDate),3) = 'NOT',

max({<SnapshotDate-={$(=SubField(GetFieldSelections(SnapshotDate),'NOT ',2))}>} SnapshotDate),

max(SnapshotDate)), -3)

But I am unable to use it in the same way I am using the simple measure above, not even as a variable.

I am unable to come up with the solution myself as I am pretty new to Qlik Sense. Id very much appreciate any help!

Tags (4)
1 Solution

Accepted Solutions

Re: Dynamic filtering

May be try this using set analysis:

Count(DISTINCT {<SnapshotDate = {"$(='>=' & Date(AddMonths(Max(SnapshotDate),-3), 'DateFieldFormatHere') & '<=' & Date(Max(SnapshotDate), 'DateFieldFormatHere'))"}>} ContractCode)

2 Replies

Re: Dynamic filtering

May be try this using set analysis:

Count(DISTINCT {<SnapshotDate = {"$(='>=' & Date(AddMonths(Max(SnapshotDate),-3), 'DateFieldFormatHere') & '<=' & Date(Max(SnapshotDate), 'DateFieldFormatHere'))"}>} ContractCode)

Not applicable

Re: Dynamic filtering

Thank you, I didnt know how to write it formally.