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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
IsaacH
Regular Visitor

DAX Average of Months Over Span of Years

I am looking to create a dax measure to find the average for each month over the span of many years to extrapulate seasonal trends (ex. finding the average of all January's, February's, March's, etc. from 2014-2022). 

This is my current code:

Monthly Average Industry =
var monthlytotal = SUMX(VALUES('Calendar'[MonthName]),'Sales'[Amount])
var distinctyear = DISTINCTCOUNT('Calendar'[Year])
return
    DIVIDE(monthlytotal,distinctyear)
 
Any help would be great 🙂
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @IsaacH ,

 

try like:

Monthly Average Industry =
var monthlytotal = SUMX(VALUES('Calendar'[MonthName]), CALCULATE(SUM('Sales'[Amount])))
var distinctyear = DISTINCTCOUNT('Calendar'[Year])
return
    DIVIDE(monthlytotal,distinctyear)

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @IsaacH ,

 

try like:

Monthly Average Industry =
var monthlytotal = SUMX(VALUES('Calendar'[MonthName]), CALCULATE(SUM('Sales'[Amount])))
var distinctyear = DISTINCTCOUNT('Calendar'[Year])
return
    DIVIDE(monthlytotal,distinctyear)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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