Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
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

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' ))))))))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

1 Reply

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' ))))))))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post