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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Folarin
Contributor II
Contributor II

Please explain this expression

HI,

 

What is the meaning of the following expression:

 

If(Count({$<[Case Is Closed]={'True'} >} %CaseId)>0, Avg ([Case Duration Time]),0)+ If(Count({$<[Case Is Closed]={'False'} >} %CaseId)>0, Avg([Case Aging]), 0)

also, what is the 0 which I colored in red

2 Solutions

Accepted Solutions
Vegar
MVP
MVP

=If( Count({$<[Case Is Closed]={'True'} >} %CaseId)>0, /*If you have any Case that is closed*/
     Avg ([Case Duration Time]), /*then calc avg case duration time*/
     0) /*else use zero*/
+
If( Count({$<[Case Is Closed]={'False'} >} %CaseId)>0, /*If you have any Case that not is closed*/
    Avg([Case Aging]), /*Then Calculate average Case Aging*/
    0 /*Else use zero*/
)

View solution in original post

jonathandienst
Partner - Champion III
Partner - Champion III

Vegar's explanation should answer your question. For the sake of completeness, you could rewrite that expression in a pure set expression (no conditionals):

RangeSum(
	Avg({$<[Case Is Closed]={'True'} >} [Case Duration Time]),
	Avg({$<[Case Is Closed]={'False'} >} [Case Aging])
)

 which may also make the intent clearer.

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
Vegar
MVP
MVP

=If( Count({$<[Case Is Closed]={'True'} >} %CaseId)>0, /*If you have any Case that is closed*/
     Avg ([Case Duration Time]), /*then calc avg case duration time*/
     0) /*else use zero*/
+
If( Count({$<[Case Is Closed]={'False'} >} %CaseId)>0, /*If you have any Case that not is closed*/
    Avg([Case Aging]), /*Then Calculate average Case Aging*/
    0 /*Else use zero*/
)

jonathandienst
Partner - Champion III
Partner - Champion III

Vegar's explanation should answer your question. For the sake of completeness, you could rewrite that expression in a pure set expression (no conditionals):

RangeSum(
	Avg({$<[Case Is Closed]={'True'} >} [Case Duration Time]),
	Avg({$<[Case Is Closed]={'False'} >} [Case Aging])
)

 which may also make the intent clearer.

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Folarin
Contributor II
Contributor II
Author

Thank you Vegar