Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to display the previous month's data?

Hi,

In report, I have to show the months and the sales happened in the last month. Ex: for Sep2010, I have to show the sales of Aug2010.

My report should be like this:

Month Sales

Sep2010 Sales of Aug 2010

Oct2010 Sales of Sep2010

Nov2010 Sales of Oct2010

How to do this? [8-)]

10 Replies
johnw
Champion III
Champion III

OK. Add a MonthType to distinguish between current and previous months. Include MonthType in a pivot table to show the data. Use set analysis with MonthType if you need to compare them in another expression, such as calculating an increase in sales.

Month, Sales
Aug 2010, 50
Sep 2010, 60
Oct 2010, 75
etc.

AsOfMonth, MonthType, Month
Sep 2010, Current, Sep 2010
Sep 2010, Previous, Aug 2010
Oct 2010, Current, Oct 2010
Oct 2010, Previous, Sep 2010
etc.

Pivot table:
Dimension 1 = AsOfMonth
Dimension 2 = MonthType
Expression = sum(Sales)

Straight table:
Dimension = AsOfMonth
Expression 1 = sum(<{MonthType={'Current'}>} Sales)
Expression 2 = sum(<{MonthType={'Previous'}>} Sales)
Expression 3 = column(1)-column(2) // difference in sales, as an example