Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

month

i need to have last month only and this month only  sales as 2 different columns in the same chart. I tried using add months concept..

any sugg

Labels (1)
8 Replies
Chanty4u
MVP
MVP

May be this?

  1. Current Month sales Expression:    =Sum({<MonthNum={'$(=Max(MonthNum))'}>}Sales) 
  2.  
  3. Previous Month sales Expression:   =Sum({<MonthNum={'$(=Max(MonthNum)-1)'}>}Sales)
MayilVahanan
MVP
MVP

HI

Try like this

Sum({<Date= {">=$(=Date(MonthStart(Today(),-1),'DD/MM/YYYY')) <= $(=Date(Floor(MonthEnd(Today())),'DD/MM/YYYY'))"}>}Sale)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
raadwiptec
Creator II
Creator II
Author

i tried this Sum({<[Month]={'$(=Max(Month)-1)'}>}Sales) .. but my output is 0

MayilVahanan
MVP
MVP

Try like this

=Sum({<[Month]={'$(=Month(AddMonths(Today(),-1)))'}>}Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
raadwiptec
Creator II
Creator II
Author

hi mayhil,

it should not be based on today .. for ex: if iam selecting 02 it should show 01 and if i select month 03 it should show 02

vishsaggi
Champion III
Champion III

Can you share a sample app to work on?

MayilVahanan
MVP
MVP

Hi

Try like this

=Sum({<[Month]={'$(=Max(Month)-1)'}>}Sales)


Note thtat: =Max(Month)-1 wil return 11 (Number format), if your month is in number format, it will work.


Otherwise,

Try like this

=Sum({<[Month]={"$(=Month(Date#(Max(Month)-1,'MM')))"}>}Sales)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sasikanth
Master
Master

HI

Try this

Current Month :  Sum({< Month= {"$(=Month(AddMonths(Max(Date_Field),0)))"}>}Sales),

Previous Month: Sum({< Month= {"$(=Month(AddMonths(Max(Date_Field),-1)))"}>}Sales),


Careful with date formats