0 Replies Latest reply: Oct 11, 2016 9:33 AM by Barbara Michalowska RSS

    Script doesn't work when applying filter

    Barbara Michalowska

      Hi guys,

       

      I am loading an Excel file into Qlik Sense which consist information on High priority problems for multiple regions:

       

      ORGINAL_PROBLEMS:
      LOAD
      Number,
      Priority,
      Region,
      Date#(Date, 'DD/MM/YYYY') as Date,
      Month(Opened) & '-' & year(Opened) AS Month,
      IF(Priority <> '3 - Moderate' and Priority <> '4 - Low', IF(Date <> Previous(Date), 1, IF(Priority <> Previous(Priority), 1, 0)) , '0') as [Unique P1/2],
      If(Priority = '1 - Critical' and Date <> Previous(Date), '1', If(Priority = '1 - Critical' and Priority <> Previous(Priority), '1', '0')) as [Unique P1]
      FROM [lib://test/QS-Problems.xls] (biff, embedded labels, table is Problems$);

       

      SORTED_PROBLEMS:
      noconcatenate
      load *
      resident ORGINAL_PROBLEMS
      order by Date asc;

      drop table ORGINAL_PROBLEMS;

       

      As you see I used script to convert data for date and month, sort data and add two IF statements to show 'event free days'.

      It works fine until I use the filter , e.g. for Region to show data only for US.

       

      Do you have any idea what I am doing wrong here?