indexing and offset for 2 dimensions is the same as for 1 dim?

Hello , I know that if we have only 1 dimension,we do:

int i = threadIdx.x + blockDim.x * gridDim.x;
int offset = gridDim.x * blockDim.x;

while ( i < N ) {
...
i+= offset

If we have :

int x = threadIdx.x + blockIdx.x * blockDim.x;
int y = threadIdx.y + blockIdx.y * blockDim.y; 
 
int Idx = x + y * Width;

int offset = gridDim.x * blockDim.x * gridDim.y * blockDim.y;

Can we do the same as before like this?

while ( Idx < N ) {
..
Idx+= offset

Or this:

for ( int Idx =  x + y * Width; Idx < N; Idx += offset ){

...