Jaspersoft studio calculate variables before detail band
<p>Jaspersoft studio 6.2. </p>

<p>The report below, there are 3 bands: title, detail, and summary. Detail is in the middle. Look at "Activated staff" on the top on title band, it used a variable (activatedstaffcount1) as expression. The variable sum all activated staff counts in the detail. However it shows null. The bottom one is in the summary band and used the same variable but it shows correct number. The middle section is the data (detail band).  I want to show aggregated result before the display data(detail band), how can I do it? </p>

<p><a href="https://i.stack.imgur.com/HVK49.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HVK49.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/CtX36.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CtX36.png" alt="enter image description here"></a></p>