Skip to main content

Create a calendar in Power BI

To enable analysis over time a calendar is required. This post describes best practices for creating date tables in your data models.

In Power BI, a date table is a table that meets the following conditions:

  • The table includes a column of data type date or date/time, which will be our date column.
  • The date column only contains unique values.
  • The date column does not contain BLANKs.
  • The date column does not have any missing dates.
  • The date column does span over full years.
  • The table has to be marked as a date table.


You can use several techniques to create a date table for your model:


Use Auto date/time option

The Auto date/time option is both fast and easy to use. To enable or disable the function navigate to File > Options and Settings > Options > Data Load > Time Intelligence

This enables users to work with time intelligence when grouping, filtering, and drilling down through calendar time periods. 

Generate with DAX

It is possible to generate a date table by creating a calculated table using DAX functions. There are two functions available for this purpose, CALENDAR or CALENDARAUTO. Both functions return a single column table of dates, but the syntax is slightly different. We will go through the two functions below. 

The CALENDAR function is preferred when you want to set a date range. The function requires two values, the start date, and the end date. It is useful to know that these values can be defined by other DAX functions, for example, MIN(Sales[TransDate]) or MAX(Sales[TransDate]). This makes the date range dynamic as it changes with the data in the Sales table. If you instead want to set a static date range utilize the following syntax, CALENDAR(<startDate>, <endDate>). 

The CALENDARAUTO function is used when you want the date range to automatically include all dates saved in the model. The advantage of this is that it is not required to extend the table for future years. When the data in the model is refreshed, it triggers a recalculation of the date table. This means the table will automatically be adjusted to new dates in the dataset. 

Comments

Popular posts from this blog

AI School: How to Use Chat GPT

Chat GPT changed the conversation about artificial intelligence - the technology that is predicted to revolutionize how businesses and individuals interact with computers. Despite its impressive potential, the service is far from user-friendly in all aspects. In a series of articles, Techsavvyminds tests and guides you, the reader, through the basics of the most talked-about AI services. First up is Chat GPT from the American company Open AI. Over half a year has passed since Chat GPT transformed the conversation about artificial intelligence. For companies, it has been said that AI can streamline everyday tasks by taking over repetitive tasks, assisting with presentation materials, and even handling email conversations. Although the hype has been hard to miss, it hasn't been obvious to everyone to explore the possibilities of this new technology. Others have tried and realized that the shortcomings are still too significant to make a real difference in everyday life. The only way ...

How to append queries in Power BI

To append queries in Power Query, you can use the "Append" transformation, which allows you to combine two or more tables by adding the rows from one table to the bottom of another table. Here is how you can do this in Power Query: 1. Open the Power Query Editor and select the tables that you want to append. 2. Click the "Home" tab in the ribbon, and then click the "Append" button in the "Combine" group. 3. In the "Append" dialog box, select the table that you want to append to the bottom of the other table, and then click "OK". Power Query will create a new query that combines the two tables by appending the rows from one table to the bottom of the other. You can then apply additional transformations as needed, and load the resulting table back into your workbook or report. Alternatively, you can also use the "Merge" transformation to combine two tables by matching rows from one table with rows from the other table ...

5 Proven Strategies to Pass the Microsoft Power BI Data Analyst - PL-300 Exam

Earning a certification in Power BI as a data analyst is a great way to validate your skills, enhance your career prospects, improve your skills, enhance your credibility, and demonstrate your commitment to professional development. To excel in this exam, candidates must have a strong grasp of Power Query and proficiency in writing Data Analysis Expressions (DAX). They should also possess knowledge in assessing data quality and be familiar with data security measures such as row-level security and data sensitivity.  The following skills are evaluated:  Prepare the data (25–30%) Model the data (25–30%) Visualize and analyze the data (25–30%) Deploy and maintain assets (15–20%) The Microsoft PL-300 exam is designed for candidates who want to validate their skills as Data Analysts. Here are some tips to help you prepare for and pass the PL-300 exam: 1. Review the exam objectives:  The first step in preparing for any exam is to review the exam objectives. These objectives pro...