Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND 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