Calculated column for the sales of the month to create Custom Data Type
I don't know if you know that Excel can display the contained of a Data Model table. The result is quiet interesting because you can use the Custom Data Type to associate your tables directly in a worksheet.
If you don't the principe, you specify in your data model a Table with a column ID and in Excel, you can call each one of the columns of that table like in this example
As you can see, I was able to create a calculated column for the last purchase date with this measure
LastDateAchat = MAX(Ventes[Date_Commande])
And I used the previous measure for the second calculated column to return the amount of the last purchase
When you're working in a calculated column you should be aware of the context transition (when is value from the row and when from the whole table). The moment you use CALCULATE the context transition happens from the row to the filter context.
In your case this means you can't access the LastDatePurchase in the row anymore, so you have to save it before as a variable before the transition happens.