How to modify column values relative to their maximum in a dataset?

I have the following dataset:

ds = Dataset@{
   <|"x" -> 1, "y" -> 45|>,
   <|"x" -> 2, "y" -> 19|>,
   <|"x" -> 3, "y" -> 20|>,
   <|"x" -> 4, "y" -> 47|>,
   <|"x" -> 5, "y" -> 30|>
   }

How can I create a new dataset the has the same “x” column but has a “y” column so that each entry in “y” is replaced by y_i - Max[#y], where Max[#y] is the maximum value of “y” in the dataset.

Here’s one way:

With[
 {maxY = ds[Max, "y"]},
 ds[All, {"x" -> Identity, "y" -> (# - maxY &)}]]