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: 
evansabres
Specialist
Specialist

Average of Current Selections

Hello -

I am looking to figure out a way to calculate the average of 4 (four) different selections (once they have been selected)

I have 4 categories:

- Opponent

- Time

- Month

- Day

For each category, there are values assigned to the records in them. (For example, once Thursday is selected, the average sales for Thursday is 12,345) This is true for each category.

I am looking to have an expression that shows the average once a selection is made in each category.

Thank you.

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Apply Swuehl expression like below:

=RangeAvg(NUM(SUM(avgTEAMSALES), '#,###.'), NUM(SUM(avgTIMESALES), '#,###.'),NUM(SUM(mnthavgSALES), '#,###.'),NUM(SUM(dayavgSALES), '#,###.'))

View solution in original post

8 Replies
vishsaggi
Champion III
Champion III

Can you post a sample app and the expected output you are looking for ?

evansabres
Specialist
Specialist
Author

Can't upload the app.

Expected output is an average of four selections

swuehl
MVP
MVP

Maybe something like this in a text box:

=If( GetSelectedCount( Day ) = 1, Sum(Sales) / Count(DISTINCT DateField) )

// or how you calculate your average

Similar for the other three fields.

edit:

Average – Which average?

evansabres
Specialist
Specialist
Author

Ultimately, I will select:

- Opponent

- Time

- Month

- Day

Each selection will yield a numerical value.

Opponent : 18102

Time : 17897

Month : 17709

Day : 18249

I know the average of these number is 17,989. However, I want to build an expression that will reflect four selections being made and averaging them

swuehl
MVP
MVP

If you can calculate your four averages in expressions, you can use

=RangeAvg( Expression1, Expression2, Expression3, Expression4)

to calculate your resulting average.

Anonymous
Not applicable

rangeavg(

    sum( $<Opponent={"??????"},Time={"??????"}, Month={"??????"},Day={"??????"} >} Sales) ,

    sum( $<Opponent={"??????"},Time={"??????"}, Month={"??????"},Day={"??????"} >} Sales) ,

    sum( $<Opponent={"??????"},Time={"??????"}, Month={"??????"},Day={"??????"} >} Sales) ,

    sum( $<Opponent={"??????"},Time={"??????"}, Month={"??????"},Day={"??????"} >} Sales)

)

--> ??????:each line a selection... but I don't know, if I really understood your problem

evansabres
Specialist
Specialist
Author

!

vishsaggi
Champion III
Champion III

Apply Swuehl expression like below:

=RangeAvg(NUM(SUM(avgTEAMSALES), '#,###.'), NUM(SUM(avgTIMESALES), '#,###.'),NUM(SUM(mnthavgSALES), '#,###.'),NUM(SUM(dayavgSALES), '#,###.'))