Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AmitSah
Contributor II
Contributor II

How to use a single combo chart to get Last 12 month vs Last Year Last 12 Month View

Hi Experts,

I am facing one issue related to Set Analysis Logic. I am new to Qlik Sense and trying to Figure out a way for my requirement.
I have an As of Date selector and below one Table which Contains Month and 2 Measures. ( 1. Last 12 month Gross Sales , 2. LY Last 12 Month Gross Sales) these 2 measures need to be calculated on the basis of the Date selected from filter pane.
Example: If I selected 2017/07/31 from As of Date selector then the last 12 months should show from that date and those 2 measures should also calculate on the basis of that.
So, I have created a Last 12 Month Measure with below Set Analysis logic:

Measure i.e

Last 12 month Gross Sales = Sum({$<Date_Derived={">=$(=Date(addmonths(Date(max(Date_Derived),'YYYY/MM/DD'),-12),'YYYY/MM/DD'))<=$(=Date(max(Date_Derived),'YYYY/MM/DD'))"}>} Gross_Sales)

and when I pulled this measure to my Chart then it is giving me correct last 12 month on the basis of the Date Selection.

But I also want to get the LY Last 12 months, for that, I thought of creating another measure with below Logic but it is including another month from LY. So, this is not working as per my requirement. So, I removed it from my Chart. The below chart is not included this Measure.

Last Year - Last 12 Months Gross Sales = Sum({$<Date_Derived={">=$(=Date(addmonths(AddYears(Date(max(Date_Derived),'YYYY/MM/DD'),-1),-12),'YYYY/MM/DD'))<=$(=Date(AddYears(Date(max(Date_Derived),'YYYY/MM/DD'),-1),'YYYY/MM/DD'))"}>} Gross_Sales)

 

Need to get LY same month value on "Last Year - Last 12 Months Gross Sales" Measure

TY vs LY single chart comp.PNG

 

Can anyone help me with this requirement?

Any Help will be appreciated.

Thanks,

Amit

Labels (1)
10 Replies
sunny_talwar

Month_Desc might be a test field... you need to sort the data in order to make sure the Above function is pulling down the records in the correct order.