Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

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

Tags (1)
4 Replies
Not applicable

Re: do we have RelativeDate function in QV?

do we have relativeDate function in qlikview,any suggestions pls

giakoum
Not applicable

Re: do we have RelativeDate function in QV?

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

Not applicable

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.

PrashantSangle
Not applicable

Re: do we have RelativeDate function in QV?

Hi,

You can use

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

if you want to add Months : AddMonths(Datefield,2)

If you want to add Years : AddYears(Datefield,2)

For details go to Help Menu.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.