Diffing Analysis Service Tabular models

One of the problems we often face when diffing Analysis Services Tabular models in a collaborative development environment is that tables, columns, and relationships can often be reordered. This is because Visual Studio caches data to disk, and when the Model.bim is reloaded, the order from disk is used, and any extra items are appended to the end of the item array.

For example, if Alice loads Bob’s changes in Visual Studio, Alice’s cached data is used to determine the order, and then Bob’s changes are appended to the end of the array. So if Alice adds a single column, the diff will appear to contain all of Bob’s changes (reordering) as well as Alice’s changes.

To help with providing more accurate diffs, we can sort the item arrays deterministically (i.e. by name). When used as a git post-commit hook, this will take care of any diffs done in code review.

I created a tiny Node.js script to perform the reordering: Tabular Normalizer.