Forum Discussion
Understanding how to format DAX code for readability
- 5 years ago
Hi Anonymous ,
at daxformatter.com you have the possibility to use your own settings (see figure):
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
FrankAT - Great catch there- that's why I love seeking inputs from professionals like you'll.
However, if by default- the DAX formatter showed a long line for this code- should I assume that as a standard best practice? (I know it's personal choice and that's why so many options in settings too)
I would like to know if the way SQLBI formatted had anything to do with the formatting rules SQLBI has on their site as I mentioned:
"Write a function inline only if it has a single argument that is not a function call"
And then this contrasting statement (I thought, not sure)
"Always put arguments on a new line if the function call has 2 or more arguments"
Hi Anonymous ,
when creating a formula, whether a DAX formula, Excel formula or programming code, several important aspects are in the foreground for me:
- The good readability
- A simple order and clear structure
- The easiest possible traceability of the formula
- And a good maintainability.
Marco Russo and Alberto Ferrari have done a valuable job with their rules for the formal writing of a DAX formula. Those who adhere to it will be able to work much more easily with DAX formulas. That is to their credit.
Everyone can choose for themselves whether they adhere very closely to this set of rules or acquire their own style in writing DAX formulas.
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)