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

Average in text box

Hi.

I have a pivot table contains of two demintions dates and departments and the expression is  Sum() sales for everyday.

I am trying to get the average for sales per day in a text box and it is not giving me the correct data.

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi,

Use

=Avg(Sales)

Or

=Avg( Aggr ( Avg ( Sales ),Dimension X ) )

Or if dimension is more use

=Avg( Aggr ( Avg ( Sales ),Dimension X, Dimension Y,Dimension Z ..... ) )

Rgds

Anand

View solution in original post

13 Replies
Not applicable
Author

so the expression is Sum(Sales)..

I tried to add in the text box Avg(Sum(Sales)), it didnt work.

Any ideas

its_anandrjs
Champion III
Champion III

Hi,

You have to use If(dates = today(),Avg(Sales) ) it will calculate average on taly basis paste this code in any text box and let me know.

or

you can use only this =Avg(Sales) with equal sign in text box.

Rgds

Anand

SunilChauhan
Champion II
Champion II

avg(Sales)

or

avg(aggr(sum(Sales),dates))

Sunil Chauhan
danieloberbilli
Specialist II
Specialist II

what if you just write: avg(sales)

or try

avg(aggr(sum(sales),dimension Y))

Regards

Daniel

its_anandrjs
Champion III
Champion III

Hi,

See the attached sample file

Rgds

danieloberbilli
Specialist II
Specialist II

Everything is right. But I guess you need to add the sales per day as data in your model. This data is missing.

Until now you only can calculate avg(sales)/365  -> but I guess that is not what you need

Not applicable
Author

The attached file is not working because it was created by another person.

If I use avg(aggr(sum(sales),dimension Y))   I get data but the data is not correct as if I do the math myself i get different Nrs.

SunilChauhan
Champion II
Champion II

avg(aggr(sum(sales),dimensioncolumn1,dimenssion column2,.......))

try using this

where dimensioncolumn1 is dimension Y

Sunil Chauhan
its_anandrjs
Champion III
Champion III

Hi,

Use

=Avg(Sales)

Or

=Avg( Aggr ( Avg ( Sales ),Dimension X ) )

Or if dimension is more use

=Avg( Aggr ( Avg ( Sales ),Dimension X, Dimension Y,Dimension Z ..... ) )

Rgds

Anand