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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
d_koti24
Creator II
Creator II

Script Problem

Hi all,

PFA

1: i want last 3 months of data in 3 Qvds  based on the field case "CaseClose" .

2: If  "Case_Key"  is not closed ,i  need to put 'CaseClose' as "NotClosed"

How to achieve this

pls  help

thanks in advance.

Thanks& Regards,

Koti

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this?

Raw:

LOAD CaseOpen,

    Case_Key,

    CaseClose,

    If(Len(Trim(CaseClose)) = 0, MonthName(Today()), MonthName(CaseClose)) as CaseClose_Temp

FROM

Raw.xlsx

(ooxml, embedded labels, table is Sheet1);

FOR i = 0 to -2 step -1

  Temp:

  NoConcatenate

  LOAD CaseOpen,

  Case_Key,

  CaseClose

  Resident Raw

  Where Num(CaseClose_Temp) = Num(MonthName(AddMonths(Today(), $(i))));

  LET vStore = Date(AddMonths(Today(), $(i)), 'MMMYYYY');

  STORE Temp into $(vStore).qvd (qvd);

  DROP Table Temp;

NEXT

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

Then where would the data go if the CaseClose is not closed?

d_koti24
Creator II
Creator II
Author

if caseclose is not there please add that to current date

sunny_talwar
MVP
MVP

May be this?

Raw:

LOAD CaseOpen,

    Case_Key,

    CaseClose,

    If(Len(Trim(CaseClose)) = 0, MonthName(Today()), MonthName(CaseClose)) as CaseClose_Temp

FROM

Raw.xlsx

(ooxml, embedded labels, table is Sheet1);

FOR i = 0 to -2 step -1

  Temp:

  NoConcatenate

  LOAD CaseOpen,

  Case_Key,

  CaseClose

  Resident Raw

  Where Num(CaseClose_Temp) = Num(MonthName(AddMonths(Today(), $(i))));

  LET vStore = Date(AddMonths(Today(), $(i)), 'MMMYYYY');

  STORE Temp into $(vStore).qvd (qvd);

  DROP Table Temp;

NEXT

d_koti24
Creator II
Creator II
Author

Hi sunny i opened new thread Issue In Splitting QVD's please look on it.