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: 
Not applicable

Counting average on specific sum

Hi,

I have a formula problem with an average calculation I am trying to set up. I have an app where I show different sales in different categories for different people using the following formula:

Count({$<[Sales Category]={"Shoes and other"}>} [Sales Person])

This formula works fine for its calculation, however when I try an rewrite it to an average calculation i cant seem to get it to work. This is the formula I have tried:

Count({$<[Sales Category]={"Shoes and other"}>})/Count(Sales Person)

but I cannot seem to get it to work. Help plz.

Cheers,

1 Solution

Accepted Solutions
Not applicable
Author

Hi all,

I solved this after several different tries:

(Count({$<[Sales Category]={"Shoes and other"}>} [Sales]) / Count (distinct [Sales Person]))

Thank you all fro your input!

Cheers,

View solution in original post

18 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

There are a two syntax problems in your expression. Try this:


Count({$<[Sales Category]={"Shoes and other"}>} [Sales Person])/Count([Sales Person])

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MK_QSL
MVP
MVP

COUNT({<[Sales Category]={"Shoes and other"}>} [Sales Person])/COUNT([Sales Person])

SunilChauhan
Champion II
Champion II

Count({$<[Sales Category]={"Shoes and other"}>} [Sales Person])/Count(Total <[Sales Category]>[Sales Person])


Try this


hope this helps

Sunil Chauhan
Not applicable
Author

thansk for the replies, however (sorry for not being clear on this) i do not want the calculation to be on the individual sales person but rather on all total sales/sales category. if i could write it freely i would want it something like:

(all sales for this category A) / (total number of sales people) = average sales category A

MK_QSL
MVP
MVP

COUNT({<[Sales Category]={"Shoes and other"}>} [Sales Person])/COUNT(TOTAL [Sales Person])

SunilChauhan
Champion II
Champion II

Count(distinct [Sales Person])/Count(Total <[Sales Category]>[Sales Person])


try this


hope this helps

Sunil Chauhan
sunilkumarqv
Specialist II
Specialist II

HI Nils

Use Aggr Hope you can make work with this function

= Avg( Aggr( count({<Sales Category={"Shoes and other"}>}),Sales Person ))

Not applicable
Author

i feel that this is close, but it does not really do what i want it to do. i just want the total on category A divided by total number of sales people, something like this

[Count(Sales category = "Shoes and other")] / Count(Sales Person)

why doesnt this work?

SunilChauhan
Champion II
Champion II

Try below


COUNT(Total <Sales category> [Sales Person])/COUNT(TOTAL [Sales Person])


provide Sales category aS DIMENSION


hope this helps



Sunil Chauhan