I don't think JMP can do exactly that, with an arbitrary formula evaluated over the dynamic grouping.
If you know the grouping and can create a formula, be sure to use the Col functions and provide the grouping column(s) as BY variable(s): Col Sum( :HC, :KeyEE ) / Col Sum( :TER, :KeyEE )
Otherwise you can compare sums (inferring the ratio) with a table in Tabulate:
![4055_hier1.png 4055_hier1.png](https://community.jmp.com/t5/image/serverpage/image-id/234i7FEB218311824145/image-size/medium?v=v2&px=400)
Or graphically in Graph Builder:
![4056_hier2.png 4056_hier2.png](https://community.jmp.com/t5/image/serverpage/image-id/235iB44CE9E37AC50E08/image-size/medium?v=v2&px=400)