Why do you need a sum() function? Can you not just created the calculated measure, and if required, select 'calculate before aggregation'? Otherwise it'll calculate afterwards - i.e. SUM() will be applied on base measures when AN view is queried, and then calculation will be executed.
If row-level calculation is needed and all fields come from same source table, consider using generated columns.