Art of DAX
Art of DAX
OF
DAX
POWER BI
DO YOU USE DAX?
WANT TO KNOW SOME GOOD PRACTICES?
1. FORMATTING
2. COMMENTING
3. SHORTCUTS
4 VARIABLES
. MEASURE TABLE
5.
GOOD PRACTICES IN DAX
Use line breaks: Break your code into multiple
lines to make it easier to read. Use line breaks
to separate different functions and arguments.
GOOD PRACTICES IN DAX
Use indentation: Indent your code to show the
hierarchy of functions and arguments. Use the
tab key or spaces to indent your code.
GOOD PRACTICES IN DAX
Use whitespace: Use whitespace to separate different
parts of your code. For example, add a space between
the function name and the first argument.
GOOD PRACTICES IN DAX
Use parentheses: Use parentheses to group functions
and arguments. This can make your code easier to read
and reduce the risk of errors.
IF YOU DON'T WANT TO
FORMAT IT ON YOUR OWN.
1. FORMATTING
2. COMMENTING
3. SHORTCUTS
4 VARIABLES
. MEASURE TABLE
5.
COMMENTING IN DAX
1. FORMATTING
2. COMMENTIN
3. G
SHORTCUTS
4 VARIABLES
. MEASURE TABLE
5.
SHORTCUTS IN DAX
Way 1 :
Hold Ctrl key & Roll Wheel of Mouse.
Way 2 :
Hold Ctrl key & "+" Key to Zoom In.
Hold Ctrl key & "-" Key to Zoom Out.
SHORTCUTS IN DAX
Way 1 :
Press "Shift" key plus "Enter" Key.
Way 2 :
Press "Alt" key plus "Enter" Key.
(It will take you to start of the new line)
SHORTCUTS IN DAX
Way 1 :
Press "Shift" key plus "Enter" Key.
Way 2 :
Press "Alt" key plus "Enter" Key.
(It will take you to start of the new line)
SHORTCUTS IN DAX
Way 1 :
Press "Ctrl" key plus "/" Key to
comment.
Press "Ctrl" key plus "/" Key to
uncomment.
www.linkedin.com/in/pushkar-bhamare
SHORTCUTS IN DAX
INDENTATION :
Way 1 :
Press "TAB" key.
Way 2 :
Press "Ctrl" key plus "]" Key to
forward Indentation.
Press "Ctrl" key plus "[" Key to
Backward Indentation.
SHORTCUTS IN DAX
1. FORMATTING
2. COMMENTING
3. SHORTCUTS
4. VARIABLES
5. MEASURE TABLE
VARIABLES IN DAX
What is a Variable?
DAX :DAX :
RESULT: RESULT:
VARIABLES IN DAX
Important Note:
We can only use Varible once It is declared,
You can not use same varible in same line untill
it is declared.
We can not use Variable once loop is closed.
Once you close Varible Loop with RETURN
statement you can not use that variable.
Declared Variable can be use in same DAX
function only.
VAR1 is Declared in Measure1 so we can use that
variable only in Measure1 not in measure2
VARIABLES IN DAX
Benifits of Variable in DAX:
Code Efficiency: By storing intermediate results in
variables, you can reuse those values multiple times
within a formula.
Easy for Complex Calculations: Variables enable you to
break down complex calculations into smaller,
manageable parts.
Easier Debugging: Variables play a crucial role in
troubleshooting and debugging DAX formulas.
Readability and Maintainability: Variables improve the
readability of DAX formulas by allowing you to assign
meaningful names to intermediate results or complex
expressions.
COMMENTING IN DAX
1. FORMATTING
2. COMMENTING
3. SHORTCUTS
4 VARIABLES
.5. MEASURE TABLE
MEASURE TABLE IN DAX