Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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

27 Replies
Kushal_Chawda

just create the Month Year field in script using

=monthname(pl_date) as MonthYear


then you get the all expression


Current Month


Sum({1<MonthYear={"$(=monthname(max(MonthYear)))"}>}sales)


Ex: For Feb

Sum({1<MonthYear={"$(=monthname(addmonths(max(MonthYear)-1)))"}>}sales)

For Jan

Sum({1<Month={"$(=monthname(addmonths(max(MonthYear)-2)))"}>}sales)


PrashantSangle

Hi,

ok . Issue was in max() it convert into number and when we use addMonths()

then it again try to convert it into date which cause the issue.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

Precisely

PrashantSangle

Hi,

We can simply use addmonths() on datefield

In his case

Month(AddMonths(max(pl_date),-1))


give better result.


Regards


Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

So essentially basing it of date field instead of Month field? That make sense

Not applicable
Author

Ya it's working Sunny


Thank you very much

Not applicable
Author

Thank you guys

After all your support and help

I closed a big issue in my work

Thanks for your efforts and helping


Thanks,

AR UMAMAHESH

khalander
Creator II
Creator II

Hi Sunny,

 

It is not working for me. It is not giving exact result. Please help.

 

Regards,

Khalander