Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
s10157754
Creator III
Creator III

Sum multiple time fields when meet specific value under a field

Dear Qlikview Experts,

How to use set analysis to sum my 'Time1', 'Time2', 'Time3' and 'Time4' fields when my 'Type' field is equal = 'M' ?

Capture.PNG

Appreciate a lot for your help!

Best Regards

QianNing

1 Solution

Accepted Solutions
keerthika
Creator II
Creator II

Hi,

    you can try this expression , iam considering the all Time fields as hh:mm so iam used hh:mm in expression , if this field is mm:ss you can change according to that,

=sum({<Type={'M'}>}interval(Timestamp#(Time1,'hh:mm'))+interval(Timestamp#(Time2,'hh:mm'))

+interval(Timestamp#(Time3,'hh:mm'))+interval(Timestamp#(Time4,'hh:mm')))

and in number tab under chart properties select Time and use Format pattern as hh:mm if you consider time field as hh:mm

View solution in original post

7 Replies
olivierrobin
Specialist III
Specialist III

hello

you can use something like

sum(${<Type={'M'}>Time1+Time2....  )

or whatever grouping function depending on your needs

keerthika
Creator II
Creator II

Hi,

    Field Time1 is hh:mm or mm:ss?

keerthika
Creator II
Creator II

Hi,

    you can try this expression , iam considering the all Time fields as hh:mm so iam used hh:mm in expression , if this field is mm:ss you can change according to that,

=sum({<Type={'M'}>}interval(Timestamp#(Time1,'hh:mm'))+interval(Timestamp#(Time2,'hh:mm'))

+interval(Timestamp#(Time3,'hh:mm'))+interval(Timestamp#(Time4,'hh:mm')))

and in number tab under chart properties select Time and use Format pattern as hh:mm if you consider time field as hh:mm

qv_testing
Specialist II
Specialist II

PFA,

vishweshwarisun
Partner - Creator
Partner - Creator

hi

try this expression:

=sum({<Type={'M'}>}Time1+Time2+Time3+Time4)Capture1.PNG

s10157754
Creator III
Creator III
Author

Dear Keerthika,

All time fields are in mm:ss.

s10157754
Creator III
Creator III
Author

Dear Keerthika B,

Thank you so much for your expression. It works like a charm! Have a nice day!

Best Regards

QianNing