Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Karim_Khan
Creator III
Creator III

Dates are not working if values are blank

Hi Team,

    I have one scenario whereas have to pick up the previous available dates if my values are Null if it is NOT NULL then we have to take current available date same is working fine till the current month values but whenever m trying to pick up blank values then dates issue are coming

E.G

From_date : 31-03-2018   and its values P1=0.433491

To_Date: 30-06-2018 and its values P1=0.301388

Date:31-07-2018

Date: 11-08-2018 and its values P1=NULL

I have created one variable for checking dates wheres values are NULL

v1=DATE(MAX({1}If(IsNull(P1)=0,'$(vToDate)'),Date))

Same is working properly till the dates which has the values but if m trying to execute the same expression wheres my P1 is NULL then its not working its not taking last available date m trying to achieve if i have selected dates from 31-03-2018 till 11-08-2018 then my variable v1 should pickup 31-07-2018 and if i select dates from 31-03-2018 till 30-06-2018 then it should pick up 30-06-2018 but if m trying to achieve above logic with given expression then its taking previous month last day for every To_dates but i want previous availbale date only if there are no values


=DATE(If(IsNull(P1)=0,'$(vToDate)',MAX({1}If(IsNull(P1),MonthEnd('$(vToDate)',-1)))))


Regards,

KK

stalwar1

KK
1 Reply
Karim_Khan
Creator III
Creator III
Author

Hi ,

We can achieve the same through below logic at script level

A1:

LOAD DATE,

     NAV

FROM

....\Desktop\Book2.xlsx

(ooxml, embedded labels, table is Sheet1);

NoConcatenate

A2:

LOAD *

Resident A1 Order BY DATE asc;

DROP Table A1;

Let vMaxDt=Date(Peek('DATE',-1,'A2'),'DD/MM/YYYY');

Let vLastNAV=Peek('NAV',-1,'A2');

LET vCurrMthDt=Date(MonthEnd(Today()-1),'DD/MM/YYYY');

Concatenate (A2)

LOAD * Inline [

DATE,NAV

$(vCurrMthDt),$(vLastNAV)

];

KK