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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Analysis and max date

Hello,  I'm trying to compare amounts based on the max month available.

My issue occurs whenever I select a month, the expressions sum the selected month's amount instead of the previous month's amount.

Here's an example of my code

First Column:

=sum({<Reporting_Period_Num = {'=(max(Reporting_Period_Num))'}>} Account_Balance)

Second column:

=sum({<Reporting_Period_Num = {'=(max(Reporting_Period_Num)-1)'}>} Account_Balance)

Labels (1)
14 Replies
Anonymous
Not applicable
Author

You're right.  Utilizing the master calendar is the better way to go here as I don't want to ignore the other filters

Not applicable
Author

Hi Sunny,

Thanks for providing this response this has helped my implement a comparison between current and previous period.

Count({$<Period_seq={$(=max(Period_seq))}>} NPS)

Count({$<Period_seq={$(=max(Period_seq-1))}>} NPS)


1=30/11/2015

2=31/12/2015

3=31/1/2016

etc

I now want to include all data over the last 12 months, so need to add a greater than sign to the above, something like:

Count({$<Period_seq>{$(=max(Period_seq-13))}>} NPS)


Can you help?


Best wishes

Anil_Babu_Samineni
MVP
MVP

May be this?

If(Period_seq > AddMonths(Max(Period_seq),-12), Count(NPS))


Or


Count({<Period_seq = {"> $(=AddMonths(Max(Period_seq),-12))"}>}NPS)


Or


Count({<Period_seq = {"> $(=AddYears(Max(Period_seq),-1))"}>}NPS)


Or


Count ({<Period_seq = {"=Aggr(If(Period_seq >AddMonths(Max(Period_seq),-1),Period_seq ),Period_seq )"}>} NPS)



Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar
MVP
MVP

Try like this:

Count({$<Period_seq = {"$(='>=' & Max(Period_seq-13) & '<=' & Max(Period_seq))"}>} NPS)

I would add less then equal to Max(Period_seq) to make sure you still see 12 months of data if you have made selections. Otherwise if you don't but the <= condition, you will see a lot of more data then you expect after selection in Period_seq

Not applicable
Author

Thanks so much!  This works!!