I'm trying to add margins to my datatable which would be revenue minus cost.
Right now my code looks like this on the html.
<ng-container matColumnDef="margin">
<mat-header-cell *matHeaderCellDef mat-sort-header>Margin</mat-header-cell>
<mat-cell *matCellDef="let project">{{project.revenue - project.cost}}</mat-cell>
</ng-container>
The app shows the right number, but I'm not able to sort the column by ascending or descending order. I'm guessing because I'm calculating it in the HTML. How can I work around this?