How to group by server when offset is used

I want to show thoughput of my message metrics grouping by server:
I am able to achieve this for one server by using:
sum(messages_sent_total)-sum(messages_sent_total offset 1m)

But I want to achieve this for multiple servers using:
sum by (instance) (sum(messages_sent_total)-sum(messages_sent_total offset 1m))
But ‘sum by’ not doing anything here.
Can anyone suggest proper way to achieve this.

@such Not 100% sure I understand, but have you tried:
sum by (instance) (messages_sent_total-messages_sent_total offset 1m)

@codlord Thank you so much. It worked!!