In order to achieve your requirement, you will need to replace post aggregation part (Avg([Sales]) THEN Avg([Value]) OVER (LastPeriods(4,[Axis.X]))) with a custom expression which will calculate Average Sales per quarter and then average for last four quarters and then add the sum of incentives price for each quarter.
Your custom expression will be like below:
(Sum(avg([Sales]) OVER (Intersect([Axis.X])) / Count() OVER (Intersect([Axis.X]))) OVER (LastPeriods(4,[Axis.X])) / UniqueCount([Quarter]) OVER (LastPeriods(4,[Axis.X])))+Sum([Price])
When you do Sum(Avg([Sales])) in any visualization, it will calculate Avg([Sales]) for each row and then Sum it up. In our dataset, Avg([Sales]) will be approx. 10.53 and then sum for each quarter.
So Quarter 1 has 10 rows so value will be 105.3 same will be for Quarter 2. For Quarter 3, it will be 10.53* 25 and for Quarter 4, it will be 10.53*50
But you want to calculated Avg of Sales per quarter so instead of Avg([Sales]) you have to do Avg([Sales]) Over(Intersect([Axis.X])) and you will get below result:
This is the Sum of Sales for each quarter because Avg Sales for each quarter is summed up for all rows in that particular quarter. But you want to get average not the sum of sales so you can divide this value by the number of rows and each row value will be summed up like for quarter 1 avg of Sales is 10 and number of rows is also 10 so 10/10 + 10/10 + 10/10 … result will be 10
Now you got the average of Sales for each quarter. Sum these values for last 4 quarters using LastPeriods function.
But you want Average Sales per quarter and then average for last four quarters so you will divide this sum by count of quarters to get average
As you got the Average Sales per quarter and then average for last four quarters now you can easily add it with the sum of Incentives Prices:
(Sum(avg([Sales]) OVER (Intersect([Axis.X])) / Count() OVER (Intersect([Axis.X]))) OVER (LastPeriods(4,[Axis.X])) / UniqueCount([Quarter]) OVER (LastPeriods(4,[Axis.X]))) + Sum([Price])
For a demonstration of this, see the attached LastPeriodsFuncDemo.dxp.