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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
RajuNatesan
Contributor II
Contributor II

Compute Avg metric

I have two columns COL_A & COL_B and I want to compute the Avergae for COL_B  only on the rows that is returned based on the Unique values on COL_A.

I tried this expression in the KPI Chart, But still I am getting the incorrect average.

Num(Avg(Aggr(Count(distinct [COL_A ]),COL_B )), '#,##0') &'(in days)'

Any help here pls

Labels (1)
  • Chart

1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

You can try something like: Avg(Aggr(Only(COL_B),COL_A))

 

View solution in original post

4 Replies
vincent_ardiet_
Specialist
Specialist

Could you illustrate with an example of dataset and excepted results?

RajuNatesan
Contributor II
Contributor II
Author

@vincent_ardiet  - Attached a sample file as requested. Average on COL_B KPI should return 60.8 considering the rows based on unique values from COL_A.

RajuNatesan_0-1697204571964.png

 

vincent_ardiet_
Specialist
Specialist

You can try something like: Avg(Aggr(Only(COL_B),COL_A))

 

RajuNatesan
Contributor II
Contributor II
Author

Thanks @vincent_ardiet_ - It worked.