Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP
MVP

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)


Highlighted

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.
Highlighted

Precisely

Highlighted

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.
Highlighted

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

Highlighted
Not applicable

Ya it's working Sunny


Thank you very much

Highlighted
Not applicable

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

Highlighted
Creator II
Creator II

Hi Sunny,

 

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

 

Regards,

Khalander