What Lag function does is to shift data by row. There are not other definitions of this function.
I might misunderstand the objective. Do you mean lagging variables (not M/Y) by a month, not by row? An issue which row-shifting based Lag is not desired is that you have multiple ID in the data, and you don't want to Customer A's data spill off to Customer B's rows. A JSL trick can address it. Another situation which by-row shift is not desired is that there are missing observations. For an example, you have monthly series for a year, but missing June. The row for June just does not exist in the data. A row-shifting based Lag will totally mess up the data. There may not have simple JSL tricks.
If my understand correctly about the objective, I have a thought. First, let's simplify the data for the illustration purpose. I cut the data down to three columns: SP_ID, M/Y, WTR_GAL. The objective is to shift WTR_GAL, by SP_ID, based on time M/Y.
![peng_liu_0-1629422156918.png peng_liu_0-1629422156918.png](https://community.jmp.com/t5/image/serverpage/image-id/35198iA4C47A00465C1CE3/image-size/medium?v=v2&px=400)
I create a copy of this table, and create two more columns:
![peng_liu_1-1629422277460.png peng_liu_1-1629422277460.png](https://community.jmp.com/t5/image/serverpage/image-id/35199i46D5A5E41D625287/image-size/medium?v=v2&px=400)
The formula for Lag(M/Y) is
![peng_liu_2-1629422329386.png peng_liu_2-1629422329386.png](https://community.jmp.com/t5/image/serverpage/image-id/35200iD3B1488991590252/image-size/medium?v=v2&px=400)
The formula for Lag WTR_GAL is the following, which is basically a copy of WTR_GAL.
![peng_liu_3-1629422363002.png peng_liu_3-1629422363002.png](https://community.jmp.com/t5/image/serverpage/image-id/35201i4B6FC84F8138D2C3/image-size/medium?v=v2&px=400)
Then I join the two tables together by matching SP_ID and M/Y==Lag(M/Y). Here is the JOIN dialog
![peng_liu_4-1629422496109.png peng_liu_4-1629422496109.png](https://community.jmp.com/t5/image/serverpage/image-id/35202i8F6447BC7881CDEF/image-size/medium?v=v2&px=400)
And here is the result
![peng_liu_5-1629422574356.png peng_liu_5-1629422574356.png](https://community.jmp.com/t5/image/serverpage/image-id/35203i722C7AFC25135325/image-size/medium?v=v2&px=400)
Notice the highlighted cell is something that one has to pay attention if using the row-shifting based Lag. But here, without row-shifting based lag, the result is what I expect. The entire operation is piecing this month data with last month data by JOIN, the result is the same as the "ideal" LAG operation.