/PowerBI_DimDate

An M Query to create a repeatable date dimension table.

MIT LicenseMIT

PowerBI_DimDate

An M Query to create a repeatable date dimension table.

Rather than creating a table from scratch, this offers a quick way to create a date table for you to create relationships with.

Installation

  • Open up Power BI and on the Home Tab, click Transform data.
    Transform Data
  • On the Home Tab click on the words New Source, then Blank Query.
    Blank Query
  • A New Query entitled Query1 will be created. On the Home Tab, click Advanced Editor.
    Advanced Editor
  • In the new Window that opens up, select all and replace with the contents of the text file.
    Query Contents
  • Select Done.
    Done

    Congratulations, the hard work is done!!

Usage

  • Click on Query1, and select your earliest date you wish to have in the table in the StartDate box by either inputting directly as MM/DD/YYYY or by clicking the calendar button.
  • Select your latest date you wish to have in the table in the EndDate box by either inputting directly as MM/DD/YYYY or by clicking the calendar button.
    Select Dates
  • Once you are happy with the earliest (StartDate) and latest (EndDate) dates in your table, click the Invoke button.
    Invoke Function
  • This will create a new Table currently entitled Invoked Function. Remember to right-click and rename to whatever naming convention is appropriate to your naming convention. Congratulations!!
    Rename Function

This will create a table ready to go with the appropriate labels and data types selected!
Output

Credits

Direct inspiration from Devin Knight's query at: https://devinknightsql.com/2015/06/16/creating-a-date-dimension-with-power-query/

License

MIT