Formula Generator

Dynamic Rolling 12-Month Sales Report

Learn how to create a dynamic, rolling 12-month sales report in Power BI using a DAX formula. This report will automatically update with the current month and provide insights into total sales for the last 12 months.


Empty image or helper icon

Prompt

How can I use DAX to create a dynamic, rolling 12-month sales report that automatically updates with the current month in Power BI?

Answer

To create a dynamic, rolling 12-month sales report in Power BI, you can use the following DAX formula:

Rolling Sales 12 Months = 
CALCULATE (
    [Total Sales],
    DATESBETWEEN (
        'Date'[Date],
        MAX ( 'Date'[Date] ) - 365,
        MAX ( 'Date'[Date] )
    )
)

Explanation:

  • The formula uses the CALCULATE function to calculate the total sales within a specific date range.
  • The DATESBETWEEN function is used to define the date range for the rolling 12-month period.
  • MAX('Date'[Date]) retrieves the maximum date from the 'Date' table, which represents the current month.
  • MAX('Date'[Date]) - 365 specifies the start date of the rolling 12-month period, which is the maximum date minus 365 days.
  • MAX('Date'[Date]) represents the end date of the rolling 12-month period, which is the maximum date.

Practical Example: Suppose you have a 'Sales' table with a 'Date' column and a 'Total Sales' column. To create a rolling 12-month sales report, you can create a measure using the above DAX formula. The measure will dynamically calculate the total sales for the last 12 months based on the current month.

Remember to replace 'Date' with the actual date column in your dataset.

By using this measure in a Power BI visual, such as a card or a line chart, you will have a rolling 12-month sales report that automatically updates with the current month.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

In this project, we will demonstrate how to create a dynamic rolling 12-month sales report in Power BI using the DAX formula provided. The report will calculate the total sales within a specific date range, encompassing the last 12 months based on the current month. The DATESBETWEEN and CALCULATE functions are used to define the date range and perform the necessary calculations. The formula can be applied to a measure in Power BI, and the resulting report can be visualized using various visual elements such as cards or line charts. By utilizing this report, businesses can track their sales performance over time, identify trends, and make informed decisions based on up-to-date data. To implement the project, the user needs to have a 'Sales' table with a 'Date' column and a 'Total Sales' column, and replace 'Date' with the actual date column in their dataset. With this dynamic 12-month sales report, businesses can have an easy-to-understand visualization of their sales performance, allowing them to monitor progress and make data-driven decisions.