Announcements
cancel
Showing results for
Did you mean:
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!

Labels (4)

• ### straight table

1 Solution

Accepted Solutions
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.

2 Replies
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.

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