# New to QlikView

Discussion board where members can get started with QlikView.

Contributor

## New to Qlikview: Calculating lean time

Hi,

Im trying to calculate the lean time between the a departure time and dop. Unfortunatelly I don't know how I can calculate this in Qlikview.

What expression should I use to calculate this?

I've attached the qlikview document.

Thanks in advance!

iSam

1 Solution

Accepted Solutions

## Re: New to Qlikview: Calculating lean time

Hi,

Have a look at the rar file.

Regards,

Kaushik Solanki

6 Replies

## Re: New to Qlikview: Calculating lean time

Hi,

Have a look at the rar file.

Regards,

Kaushik Solanki

Contributor

## Re: New to Qlikview: Calculating lean time

Hi Kaushik,

Sorry for the late reply. The formula you made works!

Now I have to figure out how to present that data in a chart.

thanks!

Aissam

Contributor

## Re: New to Qlikview: Calculating lean time

Hi Kaushik,

The expression you send me works, however i'm trying to understand the expression so I can formulated them myself. i'm still new to qlikview

Interval(date(date#(POD,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm') -      date(date#(DEP,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm'),'d hh:mm') as DEP_POD

Looking at the first line, why does date appears twice? Interval(date(date#(.........

Same goed for (POD,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm')  why did you write twice?

Second, why is it that DEP ends with 'd hh:mm' and POD with ' hh:mm'

Hope you can help me understand the above formula.

Thanks in advance!!

iSam

## Re: New to Qlikview: Calculating lean time

Hi,

Let me explain the formula.

Here is the formula

Interval(date(date#(POD,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm') -      date(date#(DEP,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm'),'d hh:mm') as DEP_POD

As per your requirement you wanted to have a time difference.

What i observed from the data which you sent is that the date coming to Qlikview is in string format, So we need to specify Qlikview that the date coming is not a string its a DATE. So for that purpose we need

date(date#(POD,'DD-MM-YYYY hh:mm'),'DD-MM-YYYY hh:mm')   Formula.

Now this formula says that Give me date(i.e Date() function) where the date coming is in Date Format (i.e Date#())

So in Date#() Function we said that the field which contains the date. i.e POD in above expression and the format in which it is. and then as a part of a date function we specified the updated format. As in this case both are the same.

Same like for the DEP.

Now 'd hh:mm' is used as a parameter to interval function. This means that give me difference in this format. i.e DAY Hour:Minute.

Hope you understood.

Regards,

Kaushik Solanki

Contributor

## Re: New to Qlikview: Calculating lean time

Thanks again for you help!!!

Qlikview has hunderds of function. You happen to know by hart that you should use "interval" to calculate the time difference. But for someone like me, how do I know that I should use that particullar function? Are all the functions explained in the Qlikview Refference Manual? What would you recommend me to understand and learn (all) the Qlikview functions?

Thanks in advance!!!

iSam

## Re: New to Qlikview: Calculating lean time

Hi,

Yes All the functions are available in Qlikview Help.

Refere Qlikview Help for better understanding of functions.

Regards,

Kaushik Solanki