Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MxJ
Frequent Visitor

Rolling year based on index

Hi All,

 

I am trying to create a rolling year (sum of retail of last 12 months) based on index (NOT on date, I don't have dates like in the example!) for each location seperate but haven't quite got what I want. Right now I am using 2 querries but the second one is giving an error. 

 

First one calculates the starting month of the rolling year, so the max index (this month) - 12 months

Rolling Year Index = MAX('Retail'[Index])-12

The second one should SUM the retail figures if the index of the row is larger than the outcome of the measure above.

Rolling Year = CALCULATE(sum('Retail'[Retail Value]);'Retail'[Index]>[Rolling Year Index])
But I get a error that a true/false expression is used with calculate.
 
I have added some of the data I use. So location A should SUM index 3-14, B also index 3-14 and C index 5-16
 
Any tips? 
 
Thanks in advance! 

set.PNG
2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@MxJ ,

 

You may add FILTER Function to the formula.

https://www.sqlbi.com/articles/filter-arguments-in-calculate/

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-chuncz-msft 

Thanks for your response! Unfortunatly I am not getting it to work with filter.. 

 
Rolling Year Index = MAX('Retail'[Index])-12

Rolling Year retail= CALCULATE(sum('Retail'[Value]);FILTER(ALL('Retail'[Index]);'Retail'[Index]>[Rolling Year Index]))

 

It just sums everything, also before the last 12 months. Am I doing something wrong?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.