Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Max month

I have the following:

=NUM(SUM({$<CommonMonth={$(=max(CommonMonth))}, CommonMonth= >} RetainedAccounts)/Sum({<CommonMonth = {"$(=date(AddYears(Date(DATE#(CommonMonth,'YYYY/MM')),-1),'YYYY/MM'))"}>} NumAccts),'#0%')

The first half calculates correctly, it finds the maximum month in my dataset and sums the retained accounts. The second part I want to do the same thing but look 1 year back (Current month but the previous year). I have tried to insert the MAX function into the second part of the statement (red text) with no luck. My aim is to have a static value no matter what date you select as it will always show the MAX date from my dataset.

Labels (1)
13 Replies
sunny_talwar

Why do you need to do that? If your top expression is working with Max(CommonMonth), it means that your date is read correctly as a date...

Capture.PNG

But anyways, try this

=Num(Sum({$<CommonMonth={$(=max(CommonMonth))}, CommonMonth= >} RetainedAccounts)/Sum({<CommonMonth = {"$(=Date(AddYears(Date(Date#(Max({1}CommonMonth),'YYYY/MM')), -1), 'YYYY/MM'))"}>} NumAccts),'#0%')

Anonymous
Not applicable
Author

Because I am trying to look 1 year back, I understood previously that I would have to convert my string YYYY/MM into a date, go back one year.

I still get a '-' when I use the revised formula.

sunny_talwar

Unless I see... I won't know.... Sorry