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:
http://www.daxformatter.com/?fx=FORMULA&r=REGION
The &fx argument is the dax code you want to format. The &r argument is optional and can be US (the default) or EU. Using EU you use the semicolon ( ; ) as a list separator, and comma ( , ) as decimal point. 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="http://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" />
</form>
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!