Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Partner
Partner

Need to plot max week/month value

Hi All,

I plotted a bar chart with -

Date/Week/Month/Quarter - as my Dimension (cyclic group)

Sum(CNT) - as my Expression


Now, the chart will look somewhat like(sample):

1.PNG


Now, if someone will change the cyclic group to Month/Week/ Quarter, it will automatically sum up all the values for that and will show the sum as a count.


But, the client needs me to show in the following way:


If a week is selected in x-axis - The bars for all the weeks shall show the max(date's) value for that week

If a month is selected in x-axis - The bars for all the months shall show the max(date's) value for that month...


Like for the above chart,

if the cyclic group is changed to month,


then it shall show

x-axis - May

y-axis - 1 (not 765454)


Hope I am able to explain my requirement here. Thanks.


7 Replies
MVP
MVP

Re: Need to plot max week/month value

Could you share your sample qvw?

Re: Need to plot max week/month value

May be create flags in the script... for example... for Month...

LOAD Date,

     If(Floor(MonthEnd(Date)) = Floor(Date), 1, 0) as MonthEndFlag

FROM ...

and then in your expression

Sum({<MonthEndFlag = {"$(=If(GetCurrentField([GroupName]) = 'Month', '1', '*'))"}, WeekEndFlag .....>} Measure)

ashokkumarm
New Contributor

Re: Need to plot max week/month value

Hello Anjali,

can you share some sample data?

Best Regards,

Ashok

Partner
Partner

Re: Need to plot max week/month value

Hi Sunny,

I tried making flags too still no luck.

It is still giving the same count i.e 765455(sum of both days).


I am attaching the qvw for reference. Please let me know whats wrong here.

Thanks for all the help.

Partner
Partner

Re: Need to plot max week/month value

PFA

Re: Need to plot max week/month value

I guess I didn't really notice that what you wanted was not really MonthEnd... it was just the max value for the month.

Re: Need to plot max week/month value

May be try this

If(GetCurrentField([time]) = 'monthname',

FirstSortedValue(Aggr(Sum(CNT), REPORT_DATE), -REPORT_DATE),

Sum(CNT))