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: 
jacek_stypulkow
Contributor II
Contributor II

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
Master
Master

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])

Anonymous
Not applicable

Try:

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

shraddha_g
Partner - Master III
Partner - Master III

You can also try

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