Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

nehapathak
New Contributor II

Previous selection data in KPI

I have one Date filter and  KPI showing total count of EMPLID (employee id)  for both current and previous selection data

when no filter is selected In the Current expression data as of maximum date is coming  and in Previous expression '0' should come

but when I remove the filter in the Previous Expression data  for all the dates is coming 

Eg-

   

when no selection of filters
Previous count of employee idCurrent count of employee id
0500 (data of recent/max month ie month4)
When I select value of month within the filter ie month2
Previous count of employee idCurrent count of employee id
1500(data of all the months)700

   

MonthCount(EMPLID)
month1200
month2700
month3100
month4(latest)500

I want instead of 1500, 500 should come

1 Solution

Accepted Solutions

Re: Previous selection data in KPI

May be try this

Count({$1<reportdate={"$(=Date(Max({$1} Date#(reportdate, 'MM/DD/YYYY')), 'MM/DD/YYYY'))"}>} EMPLID)

5 Replies

Re: Previous selection data in KPI

Try this expression for the previous selection

=Sum({$1<Month = {"$(=MaxString({$1}Month))"}>}[Count(EMPLID)])

nehapathak
New Contributor II

Re: Previous selection data in KPI

Hi Sunny,

Its not working. Also my month is in the form of a date.

So for oct-10/31/2017 for nov-11/30/2017. I am using qliksense.

Re: Previous selection data in KPI

What is your expression for current selection count?

nehapathak
New Contributor II

Re: Previous selection data in KPI

current selection expression-

if(GetSelectedCount(reportdate)=0,(count({$<reportdate={"$(=$(recent_date))"}>}EMPLID)),

Count({$}EMPLID))

variable- recent_date

max(date(date#(reportdate,'MM/DD/YYYY'),'MM/DD/YYYY'))

Re: Previous selection data in KPI

May be try this

Count({$1<reportdate={"$(=Date(Max({$1} Date#(reportdate, 'MM/DD/YYYY')), 'MM/DD/YYYY'))"}>} EMPLID)