Now in Lesson 5, we’re looking at how to get back into PowerQuery and then duplicate the PO query that we’ve already performed. This is a really useful option in a lot of scenarios but in this lesson we’re going to use it to duplicate the query that we’ve already performed for our PO dataset.
We’re then going to point the new duplicated query at a PO dataset for another month.
PowerQuery will then go and find the new PO dataset and perform all the same steps as we asked it to for our initial PO dataset.
This means that when we get in a new dataset we don’t need to key in the transformation steps all over again manually. No, we just piggyback of the steps we’ve already recorded in the workbook! Depending on the amount of transformation steps, this could be a great time saving
Datatypes and Changing Datatypes:
As we looked at in Lesson 3, there are a number of different datatypes in PowerQuery including Text, Whole Number, Decimal Number, Date, DateTime, Percentage and True/False. PowerQuery automatically assigns the Changed Type step in certain circumstances, but it is possible to manully change the datatype of data columns.
You might want to do this when PowerQuery hasn’t been able to assign, or hasn’t yet assigned a datatype for you. You’ll be able to tell this as the logo on the column header will be ABC and then 123 underneath. Alternatively, you might want to manually change the datatype that PowerQuery has assigned for you.
Making sure that each column has the appropriate dataype can be really important in PowerQuery. Here’s a couple of reasons why:
a) You may wish to sum a column with numbers in it. However if the column is formatted as a text datatype, you won’t be able to as the PowerQuery sum function can only be summed if the datatype is a number (whole number, decimal number or fixed decimal number).
b) When merging data (which we’ll get to later), you can only merge using columns that have the same datatype.
c) PowerQuery functions are split by datatype – some are specifically for use on Text datatypes, others for Number datatypes, still others for Date datatypes and so on. They can’t be used with columns of a different datatype unless you convert the data first.
To change datatype, in the PowerQuery Editor, highlight the column where you want to change the datatype, and then go to the Home tab and then to the Transform section of the ribbon. From there, select the datatype that you would like.