Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing average with the field

Hi,
I have following data sample:


ID    Category    Value      Flag

  x         A                12      Chosen

  x         B                10      Cancelled

  x         C                 5      Converted

I need to compare average value (on id level) with that of value of category with 'Chosen' Flag

The output I need is this:

ID       Category         Value   Average Value

x             A                  12         9 (Average of 12,10 and 5)

I tried applying filter (Flag=Chosen), and ruled it out while calculating average. But, that does not seem to work:


avg({$<[Category]=,[Flag]=>}[Value])

This would ignore Category and Flag while calculating the average.

7 Replies
marcus_sommer

Try: avg({$<[Category]=,[Flag]=>} TOTAL [Value])

- Marcus

MK_QSL
MVP
MVP

=avg(TOTAL {<Category, Flag>}Value)

Not applicable
Author

Hi Marcus,
Thanks for the reply but isn't working.

Not applicable
Author

This would give the overall average (same value for each row on id level).

MK_QSL
MVP
MVP

If you are looking for different AVG based on ID use below

=avg(TOTAL <ID> {<Category, Flag>}Value)

Not applicable
Author

Hi Manish,
By using the above query, filter (Category=Chosen) cannot be applied, please help. Will any query be required for Id (As dimension and value) as well?

MK_QSL
MVP
MVP

Provide sample data along with the output you want in excel.