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: 
Not applicable

How to show results from previous month from current selection month ?

Hi everyone,

I am new to qlikview.

my requirment is that,

what ever month user select,

I want to considere everything from previous one month from currently selected month.

below is the example :

I have selection box as below and I have a data for each month in the qvd.

Report Month

  Jan-2014

  Feb-2014

  Mar-2014

  Apr-2014

if user select Apr-2014, then,

I want to considere all the data from Mar-2014 and I want to display those data from Mar-2014 in straight table.

if user select Mar-2014,

then,

i want to cinsidere all the data from Feb-2014 and i want to display those data from Feb-2014 in straight table.

How can we do this in qlivkew ?

any help would be appreciated.

Thansk!.

4 Replies
upaliwije
Creator II
Creator II

In you expression type  max(report month)-1

lawrenceiow
Creator II
Creator II

If you are using a Master Calendar then add a line to that to create the ReportMonth

For example, let's say your data contains the field OrderDate (and that your master calendar is built with TempDate) then add the line:

Date(AddMonths(TempDate,1), 'MMM-YYYY') AS ReportMonth,

Then you could use a listbox for ReportMonth and whichever month you select will give you all records where OrderDate is 1 month before your ReportMonth.

For more about how to use a Master Calendar see The Master Calendar

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

Create a variable and name it vLastMonth for example and put the following expression in the variable

max(Month)-1

then use the following expression in your report

sum({$<Month={'=$(vLastMonth)'}>} [Your Measure])

Yousef Amarneh
Not applicable
Author

I used this expression in

=sum(

{1< MDate = {'$(=Date(MonthStart(AddMonths(Today(), -1)),'DD/MM/YYYY') )'      ' --- add further conditions if necessary--- '   }>}

Measure)