Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rafaelsmoreno
Frequent Visitor

M code formatter

Hi folks!

 

Just checking if any of you know a code formatter for M. I googled it but couln't find anything, so if you guys know one, please share in this post. 

 

Thanks in advance, 

 

5 REPLIES 5
Geradav
Responsive Resident
Responsive Resident

It is now available!

https://powerqueryformatter.com/

 

Regards

Hi @Geradav this is great! I gave it a test out yesterday evening and one M query worked wonderfully, and the other didn't, but both run perfectly in Power Query with no syntax errors within PQ. Weird.🤔

 

I'll post the issues on Github once today's workload is done.

 

Cheers

 

Manfred

Hi Manfred,

 

yes, the PQFormatter is more or less in beta - still some functionality missing. Just send a bug report to github - we fix it, if we can 🙂

 

Holger

mwimberger
Resolver II
Resolver II

Hi @rafaelsmoreno 

 

Reza Rad has a Beautify M Script function in his tool https://radacad.com/beautify-m-script-and-extract-row-level-security-with-power-bi-helper-version-4-... 

 

Whilst it doesn't do a similar job to what the Dax Formatter (https://daxformatter.com ) does, and the newest updates to Power Query offer the Intellisense colour coding, this Power BI Helper tool does remove the extra tab paddings before lines, and offers the ability to get all your M code copied out in one place. Useful for archiving Queries.

 

There is also a way to get Notepad++ to have M language formatting https://community.powerbi.com/t5/Community-Blog/Get-your-own-Power-Query-Editor-using-Notepad/ba-p/1... 

Bear in mind that if you like dark mode, you should set your custom setup to be compatible with this else it looks pretty messed up.

 

Cheers

 

Manfred

Stachu
Community Champion
Community Champion

I don't know of any M formatter as such, but in the PowerBI preview features there is M intellisense

https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-september-2018-feature-summary/

which makes the code much more readable

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.