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

Set Analysis

Hi,

how to show Last month sales i am getting syntax problum please help me

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Current Month

=num(sum({<[Month Year]= {"$(=Date(Max(Date#([Month Year], 'MMM YYYY')),'MMM YYYY'))"} >}Sales))

Last Month

=num(sum({<[Month Year]= {"$(=Date(Max(AddMonths(Date#([Month Year], 'MMM YYYY'),-1)),'MMM YYYY'))"} >}Sales))

View solution in original post

3 Replies
sunny_talwar

Your Month Year field is text field and not Dual (Date) Field. Make these changes in the script and rerun:

LOAD MonthName(Date#([Month&Year], 'MMM YYYY')) as MonthYear,

     Sales

FROM

[USA.xlsx]

(ooxml, embedded labels, table is Sheet1);

Once you have done that, try this expression:

=Sum({<MonthYear= {"$(=MonthName(AddMonths(Max(MonthYear), -1)))"}>} Sales)

MK_QSL
MVP
MVP

Current Month

=num(sum({<[Month Year]= {"$(=Date(Max(Date#([Month Year], 'MMM YYYY')),'MMM YYYY'))"} >}Sales))

Last Month

=num(sum({<[Month Year]= {"$(=Date(Max(AddMonths(Date#([Month Year], 'MMM YYYY'),-1)),'MMM YYYY'))"} >}Sales))

maxgro
MVP
MVP

Count({$ <[Month Year]={"$(=(Date(Max(AddMonths(Date#([Month Year], 'MMM YYYY'),-1)), 'MMM YYYY')))"}>} [Month Year])

1.png