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

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

Reply
Anonymous
Not applicable

Average based on Index column and dates

Hi Experts

 

How would you calculate the average as shown in the image below,

 

table.PNG

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and build a connection between the Month column of your data table and the Date column of the Calendar Table.  In the Calendar Table, extract Year, Month name and Month number via calculated column formulas.  Sort the Month name by month number.  Create slicers for Year and Month name and select July 2021.  Write these measures

Total = sum(data[amount])

Average 3 months = averagex(summarize(filter(calendar,datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date]))),calendar[year],calendar[month name],"ABCD",[Total]),[abcd])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and build a connection between the Month column of your data table and the Date column of the Calendar Table.  In the Calendar Table, extract Year, Month name and Month number via calculated column formulas.  Sort the Month name by month number.  Create slicers for Year and Month name and select July 2021.  Write these measures

Total = sum(data[amount])

Average 3 months = averagex(summarize(filter(calendar,datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date]))),calendar[year],calendar[month name],"ABCD",[Total]),[abcd])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
sevenhills
Super User
Super User

I am not sure whether you want to use the date column or index column in the question.

I assume as you want to do using Index column, give a try and see


6MonthAVG =
VAR MaxVal =
    CALCULATE ( MAX ( 'Table1'[IndexCol] ), ALL ( 'Table1' ) )
RETURN
    CALCULATE (
        SUM ( 'Table1'[Amount] ),
        'Table1'[IndexCol] <= MaxVal && 'Table1'[IndexCol] > (MaxVal - 6)
    ) / 6​

3MonthAVG =
VAR MaxVal =
    CALCULATE ( MAX ( 'Table1'[IndexCol] ), ALL ( 'Table1' ) )
RETURN
    CALCULATE (
        SUM ( 'Table1'[Amount] ),
        'Table1'[IndexCol] <= MaxVal && 'Table1'[IndexCol] > (MaxVal - 3)
    ) / 3

 

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.