Creating tables in M
Thanks to M language, you can create complex tables from scratch without necessarily defining them inside an external data source and then importing them in Power Query. One common example is the definition of a list of dates that can then be customized.
Getting ready
In this recipe, you only need to have Power BI Desktop running on your PC.
How to do it…
Once you open your Power BI Desktop application, you are ready to perform the following steps:
- Click on Get Data and select the Blank query connector.
- The Power Query UI will pop up and you will see an empty query with its default name as Query1:
- Browse to the Home tab and click on Advanced Editor.
We want to create a list of dates that starts at
01/01/2011
and ends on the current date. In order to define this logic, we have to use theList.Dates
expression and its syntax is as follows:List.Dates(start as date, count as number, step as duration...