Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
PhilKing01
Contributor II
Contributor II

Help with an STDEV expression

Hi, 

Hoping this is a simple answer. In summary, the STDEV expression I have below is not working. 

=vAvgLine_SSNAPCBOnSceneDuration
 
+ StDev (aggr (
avg 
( { < [Duration Clock Start to OnScene] = { '>0' } ,
[Duration Clock Start to OnScene] =   { "=min ( [Duration Clock Start to OnScene] ) "  },
[Responder Primary Sub-Type]  = {'AMB', 'RRV' , 'DECA' } ,
[Duration On Scene] = { '>0' } ,
[Duration On Scene] =   { "=min ( [Duration On Scene]  ) "  }
> }  
( [Duration On Scene]    /  86400 ) 
) ,  [Year And Month Sort]
)
*
vStdDev
 
- Where 'vAvgLine_SSNAPCBOnSceneDuration' is :
 
avg 
( aggr (
min ( { < [Duration Clock Start to OnScene] = { '>0' } ,
[Duration Clock Start to OnScene] =   { "=min ( [Duration Clock Start to OnScene] ) "  },
[Responder Primary Sub-Type]  = {'AMB', 'RRV' , 'DECA' } ,
[Duration On Scene] = { '>0' } ,
[Duration On Scene] =   { "=min ( [Duration On Scene]  ) "  }
> }  
( [Duration On Scene]    /  86400 ) 
), [Source Call Number], [Year And Month Sort]
)
 
I've done this for other similar measures (which were more simple e.g. the avg ( aggr (avg (fieldname) , yearmonth) ) but the above has me stumped. What would be the solution?
 
(I can't share the data due to confidential reasons). 
 
Thanks in advance. 
Labels (1)
1 Solution

Accepted Solutions
PhilKing01
Contributor II
Contributor II
Author

Thanks Anil, having looked through similar expressions and intentions with a colleague, it seems the Variable doesn't like to work when used within the expression. Thank you for your interest though. 

View solution in original post

4 Replies
Anil_Babu_Samineni

Try to debug the expression step by step and see if you able to get the result individually and see where is the fault? 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
PhilKing01
Contributor II
Contributor II
Author

Hi Anil, 

I've previously tried too. 

The expression above '+ stdev' returns results on its own. When I add ' + stdev (1) ' to it, it also returns results. 

I suspect that the error is being caused by the (aggr ( avg ( .... part. I can't figure out where I need a 'sum' or 'min' or similar to make this second part work. 

... + StDev (aggr
   (
      avg 
      ( { <  ....  > }  ( [Duration On Scene]    /  86400 ) 
   ) ,  [Year And Month Sort]
 ) 
)
*
vStdDev
Anil_Babu_Samineni

Without understanding the business logics, I have limited offer for you . But I will give the idea, Let's assume you are aggregating the data against medium. You can perhaps do Avg(Aggr(Median(....), Field))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
PhilKing01
Contributor II
Contributor II
Author

Thanks Anil, having looked through similar expressions and intentions with a colleague, it seems the Variable doesn't like to work when used within the expression. Thank you for your interest though.