Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andyrebs
Contributor III
Contributor III

Calls Duration in minutes

Hello,

I have a file in .csv with these fields: Caller ; Recipient ; Duration.

The field "duration" is expressed in seconds (for ex:  06 , 10 ,11, 12, 13 , 24 , 31... 1000) what I need is this field in minutes.

I tried to write this the script:

LOAD

   Duration,

   num(Duration/60, ###.0) as DurataMinuti

FROM

but if I insert a List Box, it makes ones like this picture. I need only one 0, 1, 2 etc  data.

Do you have any suggestion?

Thank you in advance.

Andrea

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

It seems you don't want the fractions of minutes (seconds), so check this example. It works very similar to the above, but it all depends on how do you want to round the fractions (18 seconds has to be rounded to 1 minute or to 0 minutes?).

Hope that helps.

Miguel

View solution in original post

5 Replies
Miguel_Angel_Baeyens

Hi,

Use your local decimal separator (likely a comma) in the Num() function. That is working fine here. The Interval#() function will do as well:

Data:

LOAD *,

     Interval(Interval#(Seconds, 'ss'), 'mm:ss') AS Minutes;

LOAD Ceil(Rand() * 1000) AS Seconds

AUTOGENERATE 20;

Hope that helps.

Miguel

Miguel_Angel_Baeyens

Hi,

It seems you don't want the fractions of minutes (seconds), so check this example. It works very similar to the above, but it all depends on how do you want to round the fractions (18 seconds has to be rounded to 1 minute or to 0 minutes?).

Hope that helps.

Miguel

andyrebs
Contributor III
Contributor III
Author

That works!

Thank you Miguel!

andyrebs
Contributor III
Contributor III
Author

18 should be 0 minute , 31 should be 1 minute.

Miguel_Angel_Baeyens

Hi Andy,

Then just replace the Ceil() function in the script by the Round() function (check the Reference Manual for further details on how the Round() function works and what parameters it accepts):

Round(Seconds/60) AS RoundMinutes;

Regards.

Miguel