UPDATE March 6, 2021
The suggested way to consume DAX Formatter is by using the Dax.Formatter NuGet package.
The documentation and the source code are available in the DaxFormatter project on GitHub.
You can find sample code in the getting started sample project.

Original blog post.
In its first two months, DAX Formatter served 3,500 requests and I see the daily trend slowly raising. If you have observed carefully the first articles published on DAX Patterns, you might have seen that you can click the link”Code beautified with DAX Formatter”.


When you click that link, you open the DAX Formatter page copying the query/formula shown in the box. The good news is that you can implement the same behavior in your articles/blogs/posts by using a GET or POST call.

The easiest way is passing the query into the URL of a GET command:


The &fx argument is the dax code you want to format. The &r argument is optional and can be US (the default), UK or Other. Using Other you use the semicolon ( ; ) as a list separator, and comma ( , ) as decimal point, instead of the , and . settings used for US and UK. Here are two examples of the same query formatted with the two settings.



Using the URL might have different limits for its length, depending on the browser. We can consider 2000 characters as a practical limit. You can overcome this limitation by using a POST command. Here is an example of a simple html form that pass the content of a textbox as the query to format:

<form action=”https://www.daxformatter.com” method=”post”>
<input type=”hidden” name=”r” value=”US” />
<textarea name=”fx”>EVALUATE calculatetable(Customers,Customer[Occupation]=”Student”)</textarea>
<input type=”submit” />

I have also received many feedback about many possible improvements of DAX Formatter – we’ll work on it, you just have to wait… but thanks for the support and appreciation!

UPDATE Feb 27, 2014

You can now use the URL syntax with the additional arguments:

embed=1 : request only the HTML formatted code

font=n : optional – set the font size

For example:



UPDATE Jan 3, 2020

You can now use the URL syntax with the additional arguments:

s=auto : optional – Automatic spacing – use the best practice as currently defined in DAX Formatter

s=true : optional – Skip space after function name: IF(

s=false : optional – Use space after function name: IF (

l=short : optional – Short lines

l=long : optional – Long lines


Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.

IF ( <LogicalTest>, <ResultIfTrue> [, <ResultIfFalse>] )