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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MaryJones
Regular Visitor

Average of the same month for the last 5 years

Hi would anyone know what dax I can use to calculate the average of the same month over the previous 5 years. So for Jan-23 the average over the previous 5 years for January would equal 20.8. 

thanks

 

For example:

Date

Cases

Jan-18

16

….

18

Dec-18

14

Jan-19

21

28

Dec-19

21

Jan-20

22

30

Dec-20

25

Jan-21

23

25

Dec-21

27

Jan-22

22

30

Dec-22

25

Jan-23

18

3 REPLIES 3
Arul
Super User
Super User

@MaryJones ,

Based on my assumption I have tried this formula, Could you use and let me know?

Last 5 Years Jan Average = 
VAR _startYear= YEAR(MAX(Table[Date]))-5
VAR _janSales = CALCULATE(
                        AVERAGE(Table[ Cases]),
                        MONTH(Table[Date])=1,
                        DATESINPERIOD(Table[Date],_startYear,5,YEAR))
RETURN _janSales

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


FreemanZ
Super User
Super User

hi @MaryJones 

With what columns are you going to present the needed measure?

Hi, the columns are Date and Cases.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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