Also check your IVM (Integrated Supply Module). Something as simple as a bad/cold soldering inside the module has been known to cause fluctuating idle, as well as sluggish acceleration.
The module is very easy to get to. And if you are confident in using a soldering iron, you can fix it yourself in 30 mins.
Article about the DIY fix:
IVM or why my engine runs sluggish??? N62 applies to ALL cars with it. E53/e65/e60/e63/e64/e66 | BMW LOGIC7
There can be lots of other causes for a bad idle. But it won't cost you anything to check this one.