Sorting on a SUM() column of a Database Paged Query

We have a Database Paged Query (DPQ) configured with a Responsive Table Generator with sortable headers.

in the DPQ we have a column which is Aggregate as SUM, ref image:

in runtime, when sorting the TotalQuantity (the summed up column name) by clicking table header, the sorting does not happen as expected.

refer image for clarity:

sorting done Desc but list is shown in random order.

how to get this list to sort properly DESC or ASC - please help?

Hey guys, requesting help on this please.