Clear Cache XMLA for SSAS Multidimensional

I often use the following XMLA code to clear database/cube/measure group cache in SSAS Multidimensional when I do performance testing between different MDX queries or versions of the same database. I am posting it here so that I can find it easily in future. You can use it to clear the cache at the database, cube or measure group levels.

<ClearCache xmlns=””&gt;





If you need to clear the cache at Database level you don’t need the lines for Cube and Measure Group. Similarly if you are clearing the cache for the whole cube you don’t need the line for the measure group.