Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rsdhavle
Creator II
Creator II

Showing only last 12 month values in a chart

I have month dimension with values jan, feb, mar etc. I have calculate lets say revenue and show it only for last 12 months inside bar chart, how can i use Addmonths in this case. i have date column on the basis of which i can calculate latest month

8 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Use below set analysis

     Sum({<Date  = {">=$(=Monthstart(addmonths(Max(Date),-12)))"}>}Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Gysbert_Wassenaar

Perhaps sum({<MyDate={'>$(=monthstart(max(MyDate),-12))'}>}MyAmount)


talk is cheap, supply exceeds demand
rsdhavle
Creator II
Creator II
Author

I am still not getting any result. I am passing Month as a dimension and above expression sum({<Date={'>$(=addmonths(monthstart(max(Date)),-12))'}>}Revenue)

I am missing on anything?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Just check for the Date format.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
rsdhavle
Creator II
Creator II
Author

Date format is DDMMYYYY

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Is it sure a Date or a text field.

     Just try this test to know that.

     Click anyone date and in text box put '=Num(Date)'

     If you see number, then its a date, else its a text.

     Kindly let us know.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Gysbert_Wassenaar

Can you post a document with some data? That way we won't have to keep guessing.


talk is cheap, supply exceeds demand
rajat2392
Partner - Creator III
Partner - Creator III

Hi Rohan,

As far as I understand the scenario, you have the dimension as month. So if you calculate suppose revenue and give the month as dimension in chart, the revenue will be calculated for all 12 months. Now suppose you have four years data (2010,2011,2012,2013), so for Jan, it will show the sum of Jan for all 4 years.

I suggest, better to use MonthName (Jan 2013, Feb 2013...) for better understanding.

If you use this MonthName dimension, you can restrict it easily then for last 12 months, and it will be more interpretable that which month and year it is showing.

Regards

Rajat