Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max(Month) not working in Set Analysis

Hi All

I am facing Set Analysis issue in Qlikview 11.2 v


The issue is

I have to show the total sum in the set expression for the last month from date



Eg: I have data for some days ( the dates may be from Jan, Feb, Mar), i have to display the data based last month. As of now we got 3 months data in future there may be a chance to increase. I used static value in set expression like below, it worked, but when I place dynamic expression it's not work.


The below one works

Static: sum({<Month={"Mar"}>}sales)



The below one not working

Dynamic :

sum({<Month={$(=Max(Month))}>}sales)


Can any one help me to solve this

1 Solution

Accepted Solutions
sunny_talwar

Alternatively, you can try this also:

Sum({<MonthNum = {$(=MaxString(MonthNum))}>}sales)

View solution in original post

27 Replies
sunny_talwar

Can you create a new field in the script like this:

Num(Month(Date)) as MonthNum

and use that in your set analysis?

Sum({<MonthNum = {$(=Max(MonthNum))}>}sales)

UPDATE: Also check if Max(Month) in text box gives you 3. If month only is month and doesn't contain Year and you have more than 1 years you might get a 12 in which case the set analysis will give a different result compared to Mar.

sunny_talwar

Alternatively, you can try this also:

Sum({<MonthNum = {$(=MaxString(MonthNum))}>}sales)

Kushal_Chawda

How you have created the Month in your script? if it is created using Month function in the script then this should work.

Not applicable
Author

I derived the month from date

Month(pl_date) as Month

Kushal_Chawda

then try this

=sum({<Month={"$(=Max(Month))"}>}sales)

Not applicable
Author

Hi Sunny,

It's working.

Thanks for your immediate response

Thanks alot

Not applicable
Author

Thanks you Guys for your un believeble support


Thanks

AR UMAMAHESH

Not applicable
Author

Hi Sunny, Can this logic works for before last month 


Ex: For Feb


Sum({1<Month={$(=MaxString(Month)-1)}>}sales)


For Jan


Sum({1<Month={$(=MaxString(Month)-2)}>}sales)


Not applicable
Author

I tried these but not works