Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month on Month Comparison.

Hi All,

I need to create a bar chart which shows the Month on Month added value.Ie.

The dimension would be MonthYear.

in Expression let say for 2015-12 it should show the sales which has been added compared to 2014-12,

sales(2015-12)-sales(2014-12) should be the added value for 2015-12.

How can i achieve the same.

Please suggest.

Regards,

Reena

1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

Hi Reena,

Try using this :

RangeSum(Sum({<Year={$(=max(Year))}>}SALES), - Above(Sum({<Year={$(=max(Year)-1)}>}SALES), Count(DISTINCT TOTAL {<Year={'$(=max(Year))'}>} Month_AsOf)))
+
RangeSum(Sum({<Year={$(=max(Year)-1)}>}SALES), - Above(Sum({<Year={$(=max(Year)-2)}>}SALES), Count(DISTINCT TOTAL {<Year={'$(=max(Year))'}>} Month_AsOf)))


And for each type create different expressions eg Type={'ABC'}


Regards

KC

Best Regards,
KC

View solution in original post

18 Replies
Anonymous
Not applicable
Author

Hi,

You can try the following:

Current Year =Sum({$<Year={$(=Max(Year))}, Mon={$(=Month(Today()))}>}Sales)

Previous Year =Sum({$<Year={$(=Max(Year)-1)}, Mon={$(=Month(Today()))}>}Sales)

Anonymous
Not applicable
Author

You can replace the function Today() with a date field

MK_QSL
MVP
MVP

Provide sample data to work ! or may be your sample application

Not applicable
Author

Hi Manish,

I have attached the sample data as well as Qvw.

Please find the attached.

Regards,

Reena

sunny_talwar

Try this expression:

sum({<Year={'$(=max(Year))'}>}Sales)

-

Above(sum({<Year={'$(=max(Year)-1)', '$(=max(Year))'}>}Sales))


Capture.PNG

Anonymous
Not applicable
Author

sum({<Year={'$(=max(Year))'},{<Month={'$(=max(Month))'}>}>}Sales), sum({<Year={'$(=max(Year)-1)'},{<Month={'$(=max(Month))'}>}>}Sales)

Not applicable
Author

Hi Sunny,

Thanks a lot for your reply.

With selections the expression is working. But if we are not selecting any Month then the chart is showin wrong results.

I have to show 2 years data without any selection and the chart should be independent of month selection. Based on selection of year it should show the same year data as well the previous year data.

Thank You

sunny_talwar

This may be:

sum({<Year={'$(=max(Year))'}>}Sales)

-

Above(sum({<Year={'$(=max(Year)-1)', '$(=max(Year))'}>}Sales), Count(DISTINCT TOTAL {<Year={'$(=max(Year))'}>} Month_Asof))

Capture.PNG

Not applicable
Author

Hi Sunny,

Thanks again.

Now the values are appearing correct but it is only visible for year 2015..