Is there a way to have column totals, but only for the top 5 rows?

  • 14 June 2019
  • 2 replies

I have a table with Margin split by Product Type, i would like to show this as a single value visualization, and compare the total margin for the Top 5 to total margin for the rest.

I have tried using the following codes which haven’t worked. If anyone has any ideas/ solutions it would be greatly appreciated 🙂

Attempt 1


(this one uses a row limit of 5)

Attempt 2


2 replies

Userlevel 3

Hi @clf333,

If I get it right, you have one column, ordering the margin from high to low, and want to compare the sum of the first five margins to the rest in the same column?

I think a table calculation as below would help with the first part.

, ${booking_analysis.margin}
, 0

This will only sum the values of the first 5 rows, and add 0’s for the rest.

You could then have another Table Calculation with

${booking_analysis.margin:total} - ${the_first_calculation}

Don’t forget to hide all other measures if you want to show both table calculations in the Single Value visualisation.

I really hope this helps 🙂


Fantastic! This was exactly what i needed, thanks so much for your help 🙂