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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
jvitantonio
Specialist III
Specialist III

Average formula

hi, I have the following:

ProductValueAverage
Product14036
Product23236



Value field is a formula, so it is NOT a field, it's calculated on the pivot expression. The average field is why I need. I tried avg(formula) but it's giving me no value. OF course this should be dinamyc according to the rows. Help?

1 Solution

Accepted Solutions
Not applicable

This might work:

avg(TOTAL aggr(count({$<Field1={"=LEN(Field1)>0"} >}Id)/count( {$<Field1={"=LEN(Field1)>0"} >} Id2), Product))

Kiran.

View solution in original post

6 Replies
swuehl
MVP
MVP

Hi,

so what's your formula alike? Do you use an aggregation function in your formula?

If so, try advanced aggregation, like

= avg( aggr( formula, Product))

Hope this helps,

Stefan

jvitantonio
Specialist III
Specialist III
Author

Hi,

My formula is a division between 2 counts with a condition like:

count({$<Field1={"=LEN(Field1)>0"} >}Id)/count( {$<Field1={"=LEN(Field1)>0"} >} Id2 )

swuehl
MVP
MVP

I see, and count is an aggregation function, therefore you have to use advanced aggregation with avg.

Have you tried above?

jvitantonio
Specialist III
Specialist III
Author

I tried that but I have the same value. May be it's applying the average only to the same row??

Not applicable

This might work:

avg(TOTAL aggr(count({$<Field1={"=LEN(Field1)>0"} >}Id)/count( {$<Field1={"=LEN(Field1)>0"} >} Id2), Product))

Kiran.

jvitantonio
Specialist III
Specialist III
Author

Hey Kiran, you get it right. Thanks!!