Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for Data Integration and Data Analytics gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Creator II
Creator II

Re: Sum multiple time fields when meet specific value under a field

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
Highlighted
Specialist III
Specialist III

Re: Sum multiple time fields when meet specific value under a field

hello

you can use something like

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

or whatever grouping function depending on your needs

Highlighted
Creator II
Creator II

Re: Sum multiple time fields when meet specific value under a field

Hi,

    Field Time1 is hh:mm or mm:ss?

Highlighted
Creator II
Creator II

Re: Sum multiple time fields when meet specific value under a field

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

Highlighted
Specialist II
Specialist II

Re: Sum multiple time fields when meet specific value under a field

PFA,

Highlighted
Partner
Partner

Re: Sum multiple time fields when meet specific value under a field

hi

try this expression:

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

Highlighted
Creator III
Creator III

Re: Sum multiple time fields when meet specific value under a field

Dear Keerthika,

All time fields are in mm:ss.

Highlighted
Creator III
Creator III

Re: Sum multiple time fields when meet specific value under a field

Dear Keerthika B,

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

Best Regards

QianNing