Dates
Dates are the backbone of temporal analysis, forming the foundation upon which we generate meaningful insights about data. There are almost 60 M functions specific to working with dates. But dates have a secret – they are really just numbers that represent the number of days prior to or after a particular reference date.
We can demonstrate this with a simple example by creating a blank query and using the advanced editor with the following code:
- Create the following query in the Power Query editor:
let Source = List.Generate(() => -10, each _ <= 10, each _ + 1) in Source
- In the List Tools | Transform tab of the ribbon, click the To Table button:
Figure 10.1: Convert list to table
- On the To Table dialog, simply click the OK button.
- Right-click the header for Column1 and choose Duplicate Column.
- Right-click the header for Column1, choose Change Type, and then Date:
Figure...