Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display current month + previous months

Hello,

I am trying to do a set analysis to allow the display financial data for the last 3 months in straight table to look something like this:

                              Current     Last     Last -1

Total Expenses          xx          xx          xx

In the expression I envisage something like this :

SUM({<$(vCurrentMonth(0))>}  Amount)

SUM({<$(vCurrentMonth(-1))>}  Amount)

SUM({<$(vCurrentMonth(-2))>}  Amount)

I will also may want to add other criteria such as 'Account Type' = "Salaries", so thought something like this :

SUM({<$(vCurrentMonth(0)) , [Account Type] = {'Salaries'}>}  Amount)

Am I on the right track, any help appreciated.

Wayne

2 Replies
arulsettu
Master III
Master III

hi

try like this

SUM({<$(vCurrentMonth)-1 , [Account Type] = {'Salaries'}>}  Amount)


create a variable vCurrentMonth = max(month field)

Not applicable
Author

if i was you i would write an if statement something like:

Sum(If( Date > = MonthStart(Today()), Amount) as Current Month

sum(if( Date < MonthStart(Today()) and Date > = Monthstart (MonthStart(Today()) -1), Amount ) as Last Month

sum(if( Date < Monthstart (MonthStart(Today()) -1) and

Date > = MonthStart(Monthstart (MonthStart(Today()) -1) -1), Amount ) as Last-1