560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
|Useful short-cut keys for use in the DAX formula editor|
|DAX contains a number of incredibly useful hidden short-cut keys, allowing you to move lines, comment code and much more!|
Who knew DAX had so many useful undocumented short-cut keys? Not us - thanks to XXL BI for bringing these to our attention.
There's a longer list on their blog; this page just shows the ones which we think the average DAX programmer will find useful.
This is something you can do in DAX Studio, but I didn't realise there was a short-cut key to do it in Power BI:
Suppose that you want to comment out these two variables.
The magic short-cut key to press is Ctrl + / (this alternately comments out the code, then uncomments it):
The result of pressing the above key combination once for our example.
This is so useful! Suppose that you want to change the name of the TotalSales variable in the code fragment below to (say) AllSales:
Start by clicking on any instance of the word you want to replace.
Having clicked in the word you want to replace, press one of the following key combinations:
|Key||What it does|
|Ctrl + D||Adds each subsequent word into the current selection.|
|Shift + Ctrl + L||Selects all occurrences of the word in the current formula.|
Here's what pressing Ctrl + D twice in arow would give for the above formula, after initially clicking on the word TotalSales:
You can now type in your new variable name, and it will overwrite each of the selected words!
In Visual Studio and SQL Server Management Studio you can use the Alt key to select multiple insertion points, but I never knew you could so something similar in DAX!
Suppose that you want to change the variable names and formulae in the example below:
We want each variable to hold exactly half of the number of rows in each table.
You want your final code to look like this:
For the final code, we've prefixed each variable name by Half and added / 2 to the end of each formula.
To do this, position the cursor at the start of the first word:
Click at the first insertion point.
Now press Ctrl + Alt + Down arrow to extend this selection point downwards:
Anything you type in will be added to each line at the selection point.
You could then repeat the trick to add the / 2 to the end of each line.
Although this may not be that useful for users of DAX, for trainers it'll be invaluable. You often have to press the Esc key when training to get rid of Intellisense bubbles like the one shown below, because they tend to hide everything else in your formula:
Power BI is suggesting ways to complete the function.
To get it back again, you can just press Alt + I:
Pressing this key combination will bring the Intellisense prompt back up again.
Suppose that you for the example below you want to move the second variable declaration before the first one:
Start by clicking within the line you want to move.
The keystroke to move this line up (or down) is simple!
|Up||Alt + Up arrow|
|Down||Alt + Down arrow|
Here's what you'll get if you press Alt + the up arrow 6 times for the above example:
The line has been moved up 6 times.
You can hold down the Shift key (unusually; it's usually the Ctrl key) at the same time to copy a line up or down instead of moving it, but this is probably less useful!
25 Aytoun Street