Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

grajesh_sgp
New Contributor II

Last 2 Months Data if Date format is DD-MMM-YY

 

Hi,

I have a requirement where i have to load always last 2 months data.I am unable to get the expected output withe below script.Can any one suggest me if I miss any thing below.

Sales:
LOAD * INLINE [
Dates, Sales
13-Jun-19, 10
15-Jul-19, 20
22-Aug-19, 25
11-Sep-19, 30
]

where Date(Date#(Dates,'DD-MMM-YY'),'MM/DD/YYYY')>'08/01/2019;

Labels (1)
1 Reply
Partner
Partner

Re: Last 2 Months Data if Date format is DD-MMM-YY

change where clause to below

where Date(Date#(Dates,'DD-MMM-YY'),'MM/DD/YYYY')>Date#('08/01/2019','MM/DD/YYYY');

 

or to make it more generic

where Date(Date#(Dates,'DD-MMM-YY'),'MM/DD/YYYY')> AddMonths(MonthStart(today()),-1);