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: 
mattdt1811
Contributor III
Contributor III

Average of Above Rows in Straight Table

Hi All,

Below is a straight table I am working on showing the total of pieces per month using the expression:

=NUM(SUM(Pieces),'###########,###')

Under it I have just a simple text box showing the average per month;
=ceil((NUM(sum(Pieces)))/12)

How do I add a row to my table to show the average pieces based on the months above?

Similar to my expression but instead of dividing by 12 months, divide by months selected/above?

My problem is if I select 2 months, my average still divides by 12, not 2.

Thanks!

 qlikchart.jpg

Labels (1)
1 Solution

Accepted Solutions
sai_katare
Contributor III
Contributor III

Hi Matt,

It can be solved using 'GetSelectedCount()' function. Use the below expression in the text box.

=if(GetSelectedCount(Month)=0,(sum(Pieces)/12),(sum(Pieces)/GetSelectedCount(Month)))

I tried this and it was working.

View solution in original post

2 Replies
sai_katare
Contributor III
Contributor III

Hi Matt,

It can be solved using 'GetSelectedCount()' function. Use the below expression in the text box.

=if(GetSelectedCount(Month)=0,(sum(Pieces)/12),(sum(Pieces)/GetSelectedCount(Month)))

I tried this and it was working.

mattdt1811
Contributor III
Contributor III
Author

Thank you! I think the 'GetSelectedCount()' function will be very useful going forward.
I didn't even know it existed! 🙂