Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a request to show data in 3 month periods,
there will be sale that started in 2016 but closed in 2022, so we need to show this as 72 months,
this will be calculated with each year starting from q1 = 3 Months, q2 = 6 Months, q3 = 9 Months and so on,.
E.g
How can this be done using dax ?
or is it better to go to sql to calculate this?
Solved! Go to Solution.
Hi @MartinDra .
You can try this method:
I create two sample tables in two years, Period table and Sales table.
Then we need to calculate the year and the quarter:
New columns:
Year = YEAR('Sales'[Date])
Quar = QUARTER('Sales'[Date])
Then
Var = 'Sales'[Year] - MIN('Sales'[Year])
Index = 'Sales'[Var] * 4 + Sales[Quar]
SUMEVERYQ =
CALCULATE (
SUM ( Sales[Sales] ),
FILTER (
'Sales',
'Sales'[Year] = EARLIER ( Sales[Year] )
&& 'Sales'[Quar] = EARLIER ( Sales[Quar] )
)
)
For the period table,
New a column:
M = MID('Period'[Period],1,2) / 3
The M column need to change to the whole number format.
The result column is :
Result =
CALCULATE (
AVERAGE ( Sales[SUMEVERYQ] ),
FILTER ( 'Sales', 'Sales'[Index] = 'Period'[M] )
)
Hope these help you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
thanks. I think its close but not exactly what I need.
I need an ability to show year as well.
so we can see progression over time,
if I just have the period it only we are limited with the number of months since begining.
So in Data Warehouse side it isnt going to work.
Any ideas on how to achieve the above?
Hi @MartinDra .
You can try this method:
I create two sample tables in two years, Period table and Sales table.
Then we need to calculate the year and the quarter:
New columns:
Year = YEAR('Sales'[Date])
Quar = QUARTER('Sales'[Date])
Then
Var = 'Sales'[Year] - MIN('Sales'[Year])
Index = 'Sales'[Var] * 4 + Sales[Quar]
SUMEVERYQ =
CALCULATE (
SUM ( Sales[Sales] ),
FILTER (
'Sales',
'Sales'[Year] = EARLIER ( Sales[Year] )
&& 'Sales'[Quar] = EARLIER ( Sales[Quar] )
)
)
For the period table,
New a column:
M = MID('Period'[Period],1,2) / 3
The M column need to change to the whole number format.
The result column is :
Result =
CALCULATE (
AVERAGE ( Sales[SUMEVERYQ] ),
FILTER ( 'Sales', 'Sales'[Index] = 'Period'[M] )
)
Hope these help you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
65 | |
64 | |
56 | |
39 | |
27 |
User | Count |
---|---|
85 | |
59 | |
45 | |
43 | |
38 |