Power Query: Key Facts
14 April 2021
Welcome to our Power Query blog. This week, I look at some shortcuts to use in Power BI Transform Data.
I am taking a trip to Power BI this week to investigate some of the key shortcuts I can take in the Advanced Editor. It’s not intended to be an exhaustive list, but just a selection of those that I find useful.
For instance, I always have Intellisense activated in ‘Options’:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image1.png/e774d10cbbb9450fc45efbe51abdf434.jpg)
The first two shortcuts are to do with creating comments in the Advanced Editor. I have accessed the M code for a query to create a calendar table:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image2.png/f32e5a15e2cf9c3e4d2d058458ce054d.jpg)
If I hold down the CTRL key and press the forward slash key (“/”), I can toggle the line I am on to include a comment, or “uncomment” it. If I select a portion of the page and then use this shortcut, all the selected lines of code are affected, viz.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image3.png/f1140ff857fc3b6f5f97a6a24f4a6fc7.jpg)
Alternatively, I can hold down ALT and SHIFT and press “A” to comment out a section of selected text:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image4.png/72aa864d2854c6fefb1083fba0ab5792.jpg)
If I want to enter text in multiple places at the same time, I can hold down ALT and then left-click where I want to enter the text.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image5.png/36776d1da4d05b45bb5a5d09375f407c.jpg)
There are also some display options I can pick when I have many lines of code. First, I will turn on the line numbers so I can see what I am doing:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image6.png/23912d3b1671861e02bebcd5183f1607.jpg)
I can then see the lines.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image7.png/6f49c288a0d88a66b427eaf4ece923d6.jpg)
I can also choose to see a ‘mini map’ of the code to help me move around.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image8.png/b9ee28d90e6b5bc92ea4aeafdad51628.jpg)
If I have a line of code that I want to move up or down in relation to the rest of the code, I can hold ALT and press the up or down arrows.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image9.png/0485ccbc83bdeec1d741bad442a1ea5f.jpg)
and then I can move it down, for example:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image10.png/daf8c4f0259ce428269c0d3d4badd32b.jpg)
Back in the Query Editor view, if I have many columns, I can hold CTRL and press “G” to choose a column to go to (that’s a bit like its Excel counterpart, CTRL + G, which calls the ‘Go To’ dialog):
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image11.png/22c6daeb82d7d69ac88f878227e04b28.jpg)
I can also move through my columns by holding down ALT and using the forward and backwards arrows. However, holding ALT and using the down arrow gives me a different result: the Sort / Filter pane is revealed:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image12.png/a1537847463e660a31158c8032525438.jpg)
Pressing CTRL and the down arrow gives me a different dropdown, where I can change the data type:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/blog-pictures/2021/power-query/229/image13.png/917da985be13220165c8d2823e95344f.jpg)
Back in the Advanced Editor, there are a few more shortcuts I can use to manipulate the lines of M code:
- Pressing TAB to indent is straightforward, but I can also use CTRL and close square bracket (“]”). The difference is that the cursor moves with the indent if I keep using TAB, whereas CTRL ] leaves the cursor at the first indent and moves the text
- I can remove whole lines by clicking on the line I wish to remove (it’s not necessary to select the whole line) and then holding CTRL and SHIFT down while I press “K”. I must be careful with this one!
- Finally, pressing CTRL and “Z” will undo changes, which is very handy when I’ve carefully entered many lines of M and then realised I have done something daft!
- CTRL and “X” will redo the change if I go too far.
I hope you found this summary of my favourite shortcuts so far found useful!
Come back next time for more ways to use Power Query!