Sum and group by display on form

Hi

I am trying to sum the sale qty and group by itemId in forecastSales table for a particualr project.

It works fine when I try in a job.

But I am trying to achieve this in form(Itemforecast). Where I will have two tabs

one with all the items and other new tab to show the grouped items,saleqty, costprice.

Thanks

Varry