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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Looking to calculate a 3 month rolling based on multiple filters

I have a set of data that looks something like this...

LocationDateVendorNameUnitsSoldTotalUnitsVendorShare
11/1/2021VendorA200100020%
21/1/2021VendorB300100030%
31/1/2021VendorC500100050%
12/1/2021VendorA25090027.78%
22/1/2021VendorB30090033.33%
32/1/2021VendorC45090050%
13/1/2021VendorA300120025%
23/1/2021VendorB600120050%
33/1/2021VendorC300120025%
14/1/2021VendorA400100040%

 

What I want to be able to do... is by location and by vendor, calculate a 3 month rolling average for the VendorShare.... so that if I'm looking at Location 1 > Vendor A>January the 3 month rolling average for Vendor Share would be 20%... but for February it would be 23.89%(AVERAGE(20%, 27.78%)) .. for March it would be 24.26% (AVERAGE(20%, 27.78%, 25%))... for April it would be 30.93% (AVERAGE(27.78%, 25%, 40%))... etc... 

 

if I PIVOT on VendorName I'm able to make it work by creating a measure using the AverageX function with a DATESINPERIOD filter... however, I would like to do this without having to do the PIVOT... because I would like to create a slicer that allows me to easily filter on VendorName... 

 

Any thoughts/suggestions would be greatly appreciated?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @Anonymous ,

 

try measure

rolling = CALCULATE(AVERAGE(Vendor[VendorShare]),ALLEXCEPT(Vendor,Vendor[VendorName],Vendor[Location]),
DATESINPERIOD(Vendor[Date],
LASTDATE(Vendor[Date]),-3, MONTH
))

Krutigawale33_0-1616473695647.png

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello @Anonymous ,

 

try measure

rolling = CALCULATE(AVERAGE(Vendor[VendorShare]),ALLEXCEPT(Vendor,Vendor[VendorName],Vendor[Location]),
DATESINPERIOD(Vendor[Date],
LASTDATE(Vendor[Date]),-3, MONTH
))

Krutigawale33_0-1616473695647.png

 

 

Anonymous
Not applicable

Awesome... this worked perfectly for what I needed... if we were in the same room I would put my arm around your shoulders and rub my knuckles on top of your head (act of endearment here in the U.S.  ;^) )

Anonymous
Not applicable

Thanks @Anonymous I am happy that solves your issue.

amitchandak
Super User
Super User

@Anonymous , Try a measure like with help from date table

Rolling 3 = divide(CALCULATE(sum(Table[Unit Sold]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-3,MONTH)) ,
CALCULATE(sum(Table[Unit Sold]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-3,MONTH), filter(allselected(Table),Table[Location] = max(Table[Location]))))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors
Top Kudoed Authors