Uneven power when stopping

I have a 2004 BMW 7 series. When approaching a stop sign, if I take my foot off the gas and coast, the car runs with a jerky motion, with the tach shifting from 800 to 1200 and then back to 800 about once or twice a second. Feels like the transmission is shifting back and forth, but on two occasions the car stalled, so maybe it is a fuel problem. Took it to the dealer twice and they can find nothing. Any ideas?

I assume automatic transmission? So you are not coasting, it’s still in gear. What happens if you put it in neutral? or put it in a lower gear?

It sounds like the torque converter is locked up and not unlocking as it should. I would start by checking the transmission fluid to assure it is at the right level and is not dark colored and smelling like it is burned.