How to Create Indentation In DAX Formula

Indentation is a convention governing the indenting of blocks of code or syntax to convey specific program structure. As it is peculiar to other programs such as Python, R, SQL among others, Power BI enables user to indent DAX formulas. In the picture below, we want to learn how to indent the Date Table that contains CALCULATE, DATE, YEAR, MIN & MAX functions.

Note, DAX formula indenting is only possible in the formula bar of the Data Model.

  • To apply indent after the Date column name, place the mouse before the CALCULATE. Executive SHIFT + ENTER and press tab key once

  • To indent the CALCULATE function, place the mouse after the CALCULATE open parenthesis and executive SHIFT + ENTER.

  • To indent the CALCULATE function Start Date argument – DATE function, place the mouse after the DATE open parenthesis and executive SHIFT + ENTER

  • To indent the YEAR function, place the mouse after the YEAR open parenthesis and Execute SHIFT + ENTER

  • To indent the MIN function, place the mouse after the MIN function closed parenthesis. Executive SHIFT + ENTER and press Backspace once

  • To indent the DATE function close parenthesis, place the mouse after DATE function Day argument which is 1. Execute SHIFT + ENTER and press Backspace once.

  • To indent the CALCULATE function End Date argument, place the mouse after the Start Date.  Executive SHIFT + ENTER

  • To indent the DATE function open parenthesis, place the mouse after the DATE open parenthesis. Execute SHIFT + ENTER

  • To indent the YEAR function, place the mouse after the YEAR open parenthesis and Execute SHIFT + ENTER

  • To indent the MAX function, place the mouse after the MAX function closed parenthesis. Executive SHIFT + ENTER and press Backspace once

  • To indent the DATE function close parenthesis, place the mouse after DATE function Day argument which is 1. Execute SHIFT + ENTER and press Backspace once.

  • Finally, to indent the CALCULATE function close parenthesis, place the mouse after second to the last parenthesis. Execute SHIFT + ENTER and press Backspace once

Posted in Blog.

One Comment

Leave a Reply

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