4 Replies Latest reply: Sep 30, 2014 4:10 AM by Prashant Sangle

# do we have RelativeDate function in QV?

Hi All,

Do we have relativeDate function in QV,if we have how we can use it and what is the important of this function.

below variable was in SAP BO format so i am trying convert it into QV.

If [MTO Status]="MTS" Then RelativeDate([Created on (0CREATEDON)];Round((([Total Replenishment Lead Time])/5)*7;0)ElseIf  [MTO Status]="MTO" Then RelativeDate([Created on (0CREATEDON)];Round(((([Total Replenishment Lead Time])/5)*7)+7;0))

Thanks

• ###### Re: do we have RelativeDate function in QV?

do we have relativeDate function in qlikview,any suggestions pls

• ###### Re: do we have RelativeDate function in QV?

what don't you explain what this function does? Then we maybe can help you...

• ###### Re: do we have RelativeDate function in QV?

here is the sample example for relativeFunction ,

=If(DayName(CurrentDate())=”Monday”;RelativeDate(CurrentDate();-3);If(DayName(CurrentDate())=”Sunday”;RelativeDate(CurrentDate();-2);RelativeDate(CurrentDate();-1)))

Lets break down this formula.

An IF expression has three components:

If(boolean_expr;value if true;value if false)

The boolean_expr part is the statement that we test.

In our case, we want to check if the CurrentDate() is a Monday.

If it is true that it is a Monday, we want to use the RelativeDate function to subtract 3 days from the CurrentDate().

If it is false, i.e. the current date is not a Monday, we need to perform a further check. This requires a second IF statement to perform this second check.

The second check asks if the CurrentDate() is a Sunday.

If it is true that it is a Sunday, we want to use the RelativeDate function to subtract 2 days from the CurrentDate().

If it is false, i.e. the current date is not a Sunday, and we know its not a Monday as we checked for that previously, then we know that the day is a Tuesday, Wednesday, Thursday, Friday or Saturday and hence we can safely use RelativeDate with a value of -1 to give us the previous working day.

• ###### Re: do we have RelativeDate function in QV?

Hi,

You can use

if you want add Days : Date(num(day+3))