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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Get Previous Month today's date

HI COmmunity,

How i can get Previous month date from Current date based on selection.


Suppose today's date 24/05/2017,


If i am select March it should be 24/03/2017

Example: this expression returns only last month current data, but my requirement based on selection.

=Date(AddMonths(Today(),-1))


Example:

  

DateClientAmount
01/02/2017AAA2500
03/02/2017AA2300
24/02/2017A1500
25/02/2017A1200
01/03/2017BBB900
03/03/2017BB612
24/03/2017B315
25/02/2017B1160
01/04/2017CCC526
03/04/2017CC789
24/04/2017C1250
25/04/2017C1165
01/05/2017DDD9000
03/05/2017DD4000
24/05/2017D9533

Textbox:  bydefault it should be 24/05/2017

Sum({<Date={'24/05/2017'}>}Amount) = 9533


when i make selection Month= Feb

Sum({<Date={'24/02/2017'}>}Amount) = 1500

How to write expression?

Thanks in Advance..

Labels (1)
2 Replies
sunny_talwar
MVP
MVP

May be like this

=Date(MakeDate(Year(Today()), Month(If(GetSelectedCount(Date) = 0, Today(), Max(Date))), Day(Today())))

kamal_sanguri
Specialist
Specialist

Hi,

Pls refer this..