5 Replies Latest reply: Jul 28, 2017 8:25 AM by Julien Le Berre

# 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!

• ###### 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

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

hi

in a KPI

• ###### 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

• ###### 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

• ###### 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