📈 Power BI DAX: 12-Month & 6-Month Rolling Sales 📊

 Rolling totals are key for trend analysis. In Power BI, you can calculate 12-month and 6-month rolling sales using DAX and a proper date table.


🔁 What is a Rolling Total?

A rolling (or moving) total adds up values over a specific trailing period — like the last 6 or 12 months.


📆 Prerequisites

✅ A proper Date table marked as a date table
✅ Your Sales table must have a valid date field


🧮 DAX for 12-Month Rolling Sales

Dax

Rolling 12M Sales = CALCULATE( SUM(Sales[Amount]), DATESINPERIOD( 'Date'[Date], MAX('Date'[Date]), -12, MONTH ) )

🧮 DAX for 6-Month Rolling Sales

Dax

Rolling 6M Sales = CALCULATE( SUM(Sales[Amount]), DATESINPERIOD( 'Date'[Date], MAX('Date'[Date]), -6, MONTH ) )

📊 Example Use Case

Use these measures in a line chart to visualize rolling trends. X-axis = 'Date'[Month], Y-axis = Rolling 12M Sales or Rolling 6M Sales.

📷 Image suggestion: Line chart comparing 6M vs 12M rolling sales over time.


✅ Best Practices

🧠 Always use a continuous date axis
⚙️ Use CALCULATE + DATESINPERIOD for flexibility
📉 Great for detecting seasonal trends and growth patterns

Comments