Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
ccastrillo
New Contributor II

Duration format conversion depending on value

Hi,

I am trying to calculate the average duration of several incidents using aggr function. My expression works, showing days or HH:MM:SS depending on format selection (Duration or automatic). But what I want is automatic switch depeding on duration value. If duration is above 24h, I wish to show" DD days, hh hours, mm minutes", but if duration is less than a day, the format should be "hh hours: mm minutes". 

The expression I am ussing is 

avg(aggr(interval(date(Max(AuditDate))-date(Min(AuditDate)),'d hh:mm'),IncidentID))

Any ideas?

Many thnaks in advance,

César

 

Labels (3)
1 Solution

Accepted Solutions
Partner
Partner

Re: Duration format conversion depending on value

Hi,

try with 

avg(aggr(interval(date(Max(AuditDate))-date(Min(AuditDate)),

If(date(Max(AuditDate))-date(Min(AuditDate))>=1,'d hh:mm:ss','hh:mm:ss')

),IncidentID))

View solution in original post

2 Replies
Partner
Partner

Re: Duration format conversion depending on value

Hi,

try with 

avg(aggr(interval(date(Max(AuditDate))-date(Min(AuditDate)),

If(date(Max(AuditDate))-date(Min(AuditDate))>=1,'d hh:mm:ss','hh:mm:ss')

),IncidentID))

View solution in original post

ccastrillo
New Contributor II

Re: Duration format conversion depending on value

Thanks StarinieriG, it works!