Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mp802377
Creator II
Creator II

Summing duration / slider not working

Hello,

I originally had this formula in script editor

// Time(num(time#(DDURATION, 'hh:mm')) + num(time#(RDURATION, 'hh:mm')) , 'hh:mm') as JourneyTime,

But then I realized if the duration went over 24 hours it would not calculate correctly. So if one duration was 15:30 and the other was 12:45 minutes it would look at is as 3:15 hours instead of 28:15

There are two sliders each with a variable (they wanted sliders). One variable as vStartJourneyTime and the other slider with vEndJourneyTime. Both are showing Number as Interval hh:mm. This worked until we noticed it was calculating total duration in hours. In the script I changed it to this:

interval(Time((DDURATION+RDURATION),'hh:mm'),'mm')  AS JourneyTime,

But now the sliders are not working when working with the chart. This was the original expression in the chart:

=Interval(Avg({$<JourneyTime={'>=$(vStartJourneyTime)<=$(vEndJourneyTime)'}>}JourneyTime),'h:mm')

It will work without the set analysis statement

=Interval(Avg(JourneyTime),'h:mm')

What am I missing?

Thank you,

Martha

1 Solution

Accepted Solutions
sunny_talwar

May be this

=Interval(Avg({$<JourneyTime={">=$(=Interval(vStartJourneyTime, 'mm'))<=$(=Interval(vEndJourneyTime, 'mm'))"}>} JourneyTime),'h:mm')

View solution in original post

2 Replies
sunny_talwar

May be this

=Interval(Avg({$<JourneyTime={">=$(=Interval(vStartJourneyTime, 'mm'))<=$(=Interval(vEndJourneyTime, 'mm'))"}>} JourneyTime),'h:mm')

mp802377
Creator II
Creator II
Author

Thank you so much! That worked!