Wednesday 21 February 2018

Generating Calendar (Date Dimension) in Power BI



Generating Calendar (Date Dimension) in Power BI


Many times, we use the date hierarchy in the analysis. Power BI generates the hierarchy for the dates. But, it will generate only the predefined levels in the date hierarchy. It shows Year, Quarter, Month and Day as Below –


But, if we want to have our defined levels, we have to have our own calendar with the specified start date and End Date.

We can use this ADDCOLUMNS function along with CALENDAR function to generate calendar Dimension.
Steps to create the above date dimension in Power BI Model –
  1. Open Power BI, Go to Modelling Menu
  2. Click on New Table icon in the ribbon
  3. Write the following Expression –
  4. Validate the expression.
  5. It will create the date dimension table starting from minimum of order date till today. You can give our own start date and end date in the calendar function.
  6. Following is the Data we can see in the dimension -
Thanks....

Please share your Comments and Suggestions....

1 comment:

  1. Thank you sir.. it's clear explanation for beginners and easy to implement.

    ReplyDelete