Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mouad_saeed
New Contributor

Pulling the correct Months data with IF statement

Hello all,

The image of the excel file below is Loaded into QV in order to connect the correct 'Boardcost' (C1) to the corresponding Date (B2).

QV is currently pulling the Date and Information from our Internal Database. I would like to write an IF expression in order to link the Excel and QV date and pull through the excel Boardcost.

The excel Date ranges from Jan-17 to Sep-17. The current expression i am looking for is similar to the one below (which doesn't currently work):

IF (TPCBoardgrade.Date < '01/02/2017', 'Jan-17',If(TPCBoardgrade.Date, > '31/01/2017' or < '01/03/2017' 'Feb-17', IF (TPCBoardgrade.Date, > '31/02/2017' or < '01/04/2017' 'Mar-17', IF (TPCBoardgrade.Date, > '31/03/2017' or < '01/05/2017' 'Apr-17', IF (TPCBoardgrade.Date, > '30/04/2017' or < '01/06/2017' 'May-17', IF (TPCBoardgrade.Date, > '31/05/2017' or < '01/07/2017' 'Jun-17', IF (TPCBoardgrade.Date, > '31/05/2017' or < '01/07/2017' 'Jul-17', IF (TPCBoardgrade.Date, > '30/6/2017' or < '01/08/2017' 'Aug-17'), 'Sep-17'))))))))

Any help in the expression above or recommendations would be greatly appreciated.

QV True Board Costs IMG.JPG

Regards,

Mo

1 Solution

Accepted Solutions

Re: Pulling the correct Months data with IF statement

Not sure, This is typo error. Try this?

IF (TPCBoardgrade.Date < '01/02/2017', 'Jan-17',

     If(TPCBoardgrade.Date > '31/01/2017' or TPCBoardgrade.Date < '01/03/2017', 'Feb-17',

     IF (TPCBoardgrade.Date > '31/02/2017' or TPCBoardgrade.Date < '01/04/2017', 'Mar-17',

     IF (TPCBoardgrade.Date > '31/03/2017' or TPCBoardgrade.Date < '01/05/2017', 'Apr-17',

     IF (TPCBoardgrade.Date > '30/04/2017' or TPCBoardgrade.Date < '01/06/2017', 'May-17',

     IF (TPCBoardgrade.Date > '31/05/2017' or TPCBoardgrade.Date < '01/07/2017', 'Jun-17',

     IF (TPCBoardgrade.Date > '31/05/2017' or TPCBoardgrade.Date < '01/07/2017',  'Jul-17',

     IF (TPCBoardgrade.Date > '30/6/2017' or TPCBoardgrade.Date < '01/08/2017', 'Aug-17', 'Sep-17' ))))))))

1 Reply

Re: Pulling the correct Months data with IF statement

Not sure, This is typo error. Try this?

IF (TPCBoardgrade.Date < '01/02/2017', 'Jan-17',

     If(TPCBoardgrade.Date > '31/01/2017' or TPCBoardgrade.Date < '01/03/2017', 'Feb-17',

     IF (TPCBoardgrade.Date > '31/02/2017' or TPCBoardgrade.Date < '01/04/2017', 'Mar-17',

     IF (TPCBoardgrade.Date > '31/03/2017' or TPCBoardgrade.Date < '01/05/2017', 'Apr-17',

     IF (TPCBoardgrade.Date > '30/04/2017' or TPCBoardgrade.Date < '01/06/2017', 'May-17',

     IF (TPCBoardgrade.Date > '31/05/2017' or TPCBoardgrade.Date < '01/07/2017', 'Jun-17',

     IF (TPCBoardgrade.Date > '31/05/2017' or TPCBoardgrade.Date < '01/07/2017',  'Jul-17',

     IF (TPCBoardgrade.Date > '30/6/2017' or TPCBoardgrade.Date < '01/08/2017', 'Aug-17', 'Sep-17' ))))))))