Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
kevbrown
Contributor II

Sum Max

I have the following expression and I want to only see the Max New_Reporting_Period but for some reason I can't get my head round it

=count(distinct If(DaysToTS_Acc<21,Risk_No))

I'm sure it's simple!

1 Solution

Accepted Solutions

Re: Sum Max

Actually these might also work:

Max

Count(DISTINCT {<DaysToTS_Acc = {'<21'}, New_Reporting_Period = {"$(=Max(New_Reporting_Period))"}>} Risk_No)

2nd Max

Count(DISTINCT {<DaysToTS_Acc = {'<21'}, New_Reporting_Period = {"$(=Max(New_Reporting_Period, 2))"}>} Risk_No)

10 Replies

Re: Sum Max

May be this

FirstSortedValue(Aggr(Count(DISTINCT {<DaysToTS_Acc = {'<21'}>} Risk_No), New_Reporting_Period), -New_Reporting_Period)

Re: Sum Max

This should show the count for the Max New_Reporting_Period

Re: Sum Max

What is the format of New_Reporting_Period  field?

kevbrown
Contributor II

Re: Sum Max

Awesome, thanks Sunny, and to do the previous month?

Re: Sum Max

This

FirstSortedValue(Aggr(Count(DISTINCT {<DaysToTS_Acc = {'<21'}>} Risk_No), New_Reporting_Period), -New_Reporting_Period, 2)

Re: Sum Max

Actually these might also work:

Max

Count(DISTINCT {<DaysToTS_Acc = {'<21'}, New_Reporting_Period = {"$(=Max(New_Reporting_Period))"}>} Risk_No)

2nd Max

Count(DISTINCT {<DaysToTS_Acc = {'<21'}, New_Reporting_Period = {"$(=Max(New_Reporting_Period, 2))"}>} Risk_No)

kevbrown
Contributor II

Re: Sum Max

Yes, these worked perfectly. Thank you

kevbrown
Contributor II

Re: Sum Max

Last question on this, can this be adapted to be a rolling 3 month? so included the Max 3 months?

Re: Sum Max

May be this

Count(DISTINCT {<DaysToTS_Acc = {'<21'}, New_Reporting_Period = {"$(='>=' & Max(New_Reporting_Period, 3) & '<=' & Max(New_Reporting_Period))"}>} Risk_No)