Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Have month and year as my dimension in a table and I want to create a measure that calculates the previous year sales

Hi,

As I'm new to Qlik Sense, can I please get some help on the following issue in Qlik Sense:

I created a table that has a single column dimension such as:

 

Jul-14
Aug-14
Sep-14
Oct-14

I then want to create a measure that calculate the sales of the previous year (which I do have in my loaded data) corresponding to the dimension so that it looks like this:

  

Jul-14Sales of Jul-13
Aug-14Sales of Aug-13
Sep-14Sales of Sep-13
Oct-14Sales of Oct-13

Thanks for reading and helping out. Cheers.

2 Replies
Gysbert_Wassenaar

You'll need a table that links each month with the month of the year before.

AsOf:

LOAD Distinct MonthYear as ReportMY, MonthYear, 'Current' as Period

FROM ...source...

Concatenate(AsOf)

LOAD Distinct MonthYear as ReportMY, date(AddYears(MonthYear, -1),'MMM-YY') as MonthYear, 'Previous' as Period

FROM ...source...

The above assumes you've already turned the MonthYear field in a date field formatted in the MMM-YY format (or created a MonthYear field from your source field using the date# and date functions.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for the help Gysbert. Cheers!