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.
Hi everyone,
I'm looking to create a Measure that allows me to group sales data by a fixed number of consecutive Rows - to calculate the sum of 12 months sales periods for a Product. For example, if a Product goes on sale in the middle of the year, and the first period of sales is 201706 (as in graph below), how do I calculate the Sum of Volume for the next 12 periods to make up the total 12 month sales period, and then the following 12 month periods?
My aim is to have a graph that shows me:
Y1: Total sales (Sum of Volume for 13 consecutive periods)
Y2: Total sales (Sum of Volume for 13 consecutive periods)
Y3: Total sales (Sum of Volume for 13 consecutive periods)
Etc!
Solved! Go to Solution.
Hi @BenW86
Please refer to attached sample file with the proposed solution
12 Months Period =
"Y" & QUOTIENT ( RANKX ( 'Table', 'Table'[Period],, ASC, Dense ), 12 ) + 1
Hi @BenW86
Please refer to attached sample file with the proposed solution
12 Months Period =
"Y" & QUOTIENT ( RANKX ( 'Table', 'Table'[Period],, ASC, Dense ), 12 ) + 1
This works perfectly, thank you @tamerj1!
I wonder if you might help with another issue...? I've just noticed that no data was recorded for certain periods (notably during the pandemic where accurate sales data could not be guaranteed). Is there a way to account for this?
For example: Here you can see that Periods 4-6 are missing from the data set:
Would I need to build a proper calendar to ensure Periods are still counted within the Year (Y), even if they are not present?
Thanks again!
@BenW86
This need to be done in the date table
12 Months Period =
"Y" & QUOTIENT (
RANKX (
'Table',
LEFT ( 'Table'[Period], 4 ) * 12 + RIGHT ( 'Table'[Period], 2 ),,
ASC, Skip
),
12
) + 1
or
12 Months Period =
"Y" & QUOTIENT (
RANKX (
'Table',
'Table'[Year] * 12 + 'Table'[Month],,
ASC, Skip
),
12
) + 1
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 |
---|---|
19 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
25 | |
10 | |
10 | |
9 | |
6 |