Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld May 10-12, Online and Free! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jacek_stypulkow
Contributor
Contributor

Previous Month expresion

Hello,

can anybody help please

I have used and following expression to sum the values for current month which works fine:

SUM({$<[Date]={'>=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))'}>}[Sales Actual])

I need to find separately values for previous month trying below expression, but it doesn't work:

SUM({$<[Date]={'>=$(=MonthStart(Today()),-1))<=$(=MonthEnd(Today()),-1))'}>}[Sales Actual])

Any suggestion please

rgds

Jacek

5 Replies
brunobertels
Specialist II
Specialist II

Hi

Suppress the comma before -1 lire this :

SUM({$<[Date]={'>=$(=MonthStart(Today())-1))<=$(=MonthEnd(Today())-1))'}>}[Sales Actual])

tcullinane
Creator II
Creator II

extra ) in there after today(), the ,-1 is part of the monthstart arguments


SUM({$<[Date]={'>=$(=MonthStart(Today(),-1))<=$(=MonthEnd(Today(),-1))'}>}[Sales Actual])

MK9885
Master II
Master II

Use Master Calendar and it's Flags to save the pain for using complex Set analysis in front end.

Flags are fairly easy to use.

Master Calendar Script

Your expression will look

Sum({< LastMonthFlag = {1}>}[Sales Actual])

mov
Champion III
Champion III

Try:

SUM({$<[Date]={'>=$(=MonthStart(Today(),-1))<=$(=MonthEnd(Today(),-1))'}>}[Sales Actual])

shraddha_g
Partner
Partner

You can also try

SUM({$<[Date]={'>=$(=addmonths(MonthStart(Today()),-1))<=$(=addmonths(MonthEnd(Today()),-1))'}>}[Sales Actual])