Visual Studio Code

Compare DAX and M formulas in Visual Studio Code

Compare DAX and M formulas in Visual Studio Code is really easy with the help of Power BI Sidetools.
As it is possible to transfer DAX and M formulas from Power BI desktop to files and to open them in Visual Studio Code, it is possible to compare two files. That’s extremely useful in many cases.

Have a look at this blog post about Power BI Sidetools and download it in the ‘Setup’ chapter : https://thebipower.fr/index.php/power-bi-sidetools/

Step 1 : Select files in Visual Studio Code explorer

In the explorer window, right click on a file

Visual Studio Code

Then click on ‘Select for compare’

Visual Studio Code

In the explorer window, right click on another file and click on ‘Compare with selected’

Visual Studio Code

Step 2 : Compare files

Visual Studio Code

Files are opened next to each other . You will notice differences are coloured. Plus or minus signs appear next to the line numbers. You can still modify files.

On the top right of VS Code window, two arrows allow you to navigate through differences

Visual Studio Code

Conclusion

Comparing formulas can be really usefull and really easy using Visual Studio Code.
Watch this video from Code 2020 for few more tips :

Several Visual Studio Code extensions provide also compare tools.
You may check “Compare folders” from MoshFeu : https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders

Please stay tuned to discover more functionalities coming soon. You may subscribe to be aware of new content clicking here.

Custom analyser

Custom analyser

With ‘Custom analyser’ feature, Power BI Sidetools users can use external tools built by the…

Read More

4 Comments

  1. This looks extremely useful.
    However, I don’t seem to have much luck with using Power BI Sidetools on my PBIX (which has measures) but is Live Connected to a back-end PBIX. If I wanted to compare measures, I would think that this does not matter. I do have the “Store datasets using enhanced metadata format” selected.
    Can you advise if this should be working and it’s a problem between the chair and the keyboard?
    Thanks

    1. Hello Stephen,
      I didn’t check this configuration yet. Could you provide simple pbix files to allow me to correct the issue?
      Thanks for the feedback !

  2. Very very useful tool indeed, that will allow to store in git or any control version system all the formulas in text format (comparable between versions) instead of saving the binary, unreadable pbix file…
    Much appreciated !
    Looking forward to being able to modify code “live” in VS and reimport it in PBI Desktop to see changes.

    1. Thank you Aurelien,
      I worked already on the Files to PBI transfer and that works. As soon as a file is saved, it can be transfered automatically to the desktop. The problem is writing to the desktop is supported by Microsoft only for measures at the moment. Stay tuned

Leave a Reply

Your email address will not be published. Required fields are marked *