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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
SebaSpotti
Advocate II
Advocate II

Measure average for multiple months

Hi all!

 

I have a table with two column "EvaluationDate" and "Evaluation". In the first column I have dates, in the second numbers.

Given a specific month and year that can be changed through a slicer, I want to calculate the AVERAGE(Evaluation) for that month and the previous 12 months, and show the results in an histogram or line chart.

 

Any suggestions?

Thank you!

1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @SebaSpotti , 

 

Firstly make sure to have "Date table" created and map date table "Dates" to "Evaluation Date" then please try the below code..

 

This measure will help to go back 12 month and see the data..

 

RollingAvgEval =
CALCULATE(AVERAGE('YourTable'[Evaluation]),
DATESINPERIOD('DateTable'[Date],
MAX('YourTable'[EvaluationDate]),-12,MONTH))

 

Finally, Drag the Datetable column to the axis of the chart and measure created and adjust the axis accordingly

 

If you find this helpful , please mark it as solution and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

View solution in original post

3 REPLIES 3
dharmendars007
Super User
Super User

Hello @SebaSpotti , 

 

Firstly make sure to have "Date table" created and map date table "Dates" to "Evaluation Date" then please try the below code..

 

This measure will help to go back 12 month and see the data..

 

RollingAvgEval =
CALCULATE(AVERAGE('YourTable'[Evaluation]),
DATESINPERIOD('DateTable'[Date],
MAX('YourTable'[EvaluationDate]),-12,MONTH))

 

Finally, Drag the Datetable column to the axis of the chart and measure created and adjust the axis accordingly

 

If you find this helpful , please mark it as solution and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

Hi!

Yes, I tried this solution but it works only for the last month (see MAX('YourTable'[EvaluationDate]) ). I would like to chose the month from which going backward. 

Using a second data columns it works @dharmendars007 , thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.