2 Replies Latest reply: Oct 11, 2016 3:51 AM by Daniel Szentivany RSS

    Dynamic filtering

    Daniel Szentivany

      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!