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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need expression for previous month

Hi all,

  I need to show previous month amount  on selecting the current month PFA

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi see attach example

you have to text boxes

1. current selection amount

2 . previous month amount

View solution in original post

10 Replies
tresesco
MVP
MVP

Your month field is empty. Correct the date format, and reload to get month properly, and re-upload sample qvw.

Not applicable
Author

Hi Tresesco

PFA

PrashantSangle

Hi,

I go through your data,

You have many date for similar month,

So you want sale for same month date of previous month ??

or complete sale of previous month?

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Hi Max,

Here my date field is 'pstng date'. i need to show complete sale of previous month

tresesco
MVP
MVP

See the attached sample.

Expression:

Sum({<month= , [Pstng Date]={">=$(= MonthStart(Addmonths(Max([Pstng Date]),-1)))<=$(= MonthEnd(Addmonths(Max([Pstng Date]),-1)))"}>}Amount)

lironbaram
Partner - Master III
Partner - Master III

hi see attach example

you have to text boxes

1. current selection amount

2 . previous month amount

Not applicable
Author

Hi Liron/tresesco,

  If you don't mine can you please explain the expression bco'z  i don't get the use of add months  over there

Thanks & Regards,

Nagaraj

tresesco
MVP
MVP

Addmonths(Max([Pstng Date]),-1) ---- this takes you -1 month ahead, i.e. one month backward from the maximum date of [Psttng Date] possible.

MonthStart(Addmonths(Max([Pstng Date]),-1)) ---- further works on that one month earlier date. MonthStart() gives the starting date of that date which is one month earlier, effectively, it gives you the first date of the earlier month.

Not applicable
Author

Thank'z for your response tresesco.., but wen i tried the expression by removing add months .. it's working fine