Qlik Community

Qlik Sense App Development

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

jleberre
New Contributor

Calculate difference at min/max date of a selected period

Hello

I'm trying to calculate the difference between the number of customers at the min date of the selected period, and the number of customers at the max date of the selected period.

My idea is to perform an operation like this (but not sure it is a good solution): count(customers at max date) - count(customers at min date)

I've tried :

count({<Month={'=max(Month)'}>}distinct CustomerID) ...

and

FirstSortedValue(Aggr(count(distinct CustomerID),Month),-Month) ...

But it doesn't work.

Any idea?

Thanks!

Tags (1)
5 Replies
prat1507
Valued Contributor

Re: Calculate difference at min/max date of a selected period

hi

Are you using this in a text box or a chart?


Regards
Pratyush

jleberre
New Contributor

Re: Calculate difference at min/max date of a selected period

hi

in a KPI

prat1507
Valued Contributor

Re: Calculate difference at min/max date of a selected period

There's no problem with the method you're using, can you plz share a sample KPI.


Regards
Pratyush

arvind_patil
Valued Contributor II

Re: Calculate difference at min/max date of a selected period

Hi Julien,

Please try below one:

count({<Month={'=max(Month)'}>}distinct CustomerID) -count({<Month={'=Min(Month)'}>}distinct CustomerID)


Thanks,

Arvind Patil

jleberre
New Contributor

Re: Calculate difference at min/max date of a selected period

I've already tested that

count({<Month={'=max(Month)'}>}distinct CustomerID) don't give the correct value

Regards

Community Browser