Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Qliksense_77
Creator
Creator

Minutes between timestamps distribute per hour

Hi,

I have data with timestamps for start and end. I want to calculate the minutes between the timestamps and distribute per hour.

Anybody that can help?

My data:  
Start_timestamp End_timestamp
04/02/2022 12.55.00 04/02/2022 15.25.00
   
   
   
Desired output:  
   
DateTime Minutes
04/02/2022 12 5
04/02/2022 13 60
04/02/2022 14 60
04/02/2022 15 25
Labels (1)
4 Replies
vinieme12
Champion III
Champion III

use Interval()

 

Interval(Timestamp#(End_timestamp,'dd/mm/yyyy hh.mm.ss')-Timestamp#(Start_timestamp,'dd/mm/yyyy hh.mm.ss'),'mm') as minutes_diff

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Qliksense_77
Creator
Creator
Author

@vinieme12  thanks for the reply and sorry for my bad english.

My problem is not calculating the minutes between the timestamps. 

I want to calculate the minutes between the timestamps per hour. For instans at hour 15 there are 25 minutes between the timestamps. And at hour 14 there are 60 minutes between the timestamps and so on.

Or
MVP
MVP

You would likely need to use Load ... While and IterNo() to create a record for each hour ((IterNo()-1)/24) should be the means to add hours to the starttime. For each hour, you'll need to calculate the lesser of Endtime minus that hour, or 60, which you should be able to do using RangeMin().

Qliksense_77
Creator
Creator
Author

@Or , thanks for the reply.

Can you write the load script 🙂 

I cant get this to work.