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
VSepaha
Regular Visitor

Calculating Average for Column Over Certain Number of Months

Hi Everyone,

 

I am working on creating a table that can show the average number of requested talent for a certain skill. I currently have a table as shown below:

VSepaha_0-1600786235149.png

The middle column in the 'Average Requested Number of Talent per Month' over a period of 4 months. As you can see from the table, most of the values are calculated correctly, for exmaple, PYTHON has 30 Talent requested and the average is (30/4) 7.5. However, when we got lower into MS WINDOWS AZURE it has 22 Talent requested and the average comes to 11.  I'm not sure why this is the case.

I created this measure through a quick measure and this is the DAX that it returned:

Avg Requsted Number of Talent per Month =
AVERAGEX(
    KEEPFILTERS(VALUES('Gap Operating Trends - Gap'[REQUEST_CREATED_DATE].[Month])),
    CALCULATE(SUM('Gap Operating Trends - Gap'[REQUESTED_NUMBER_OF_TALENT]))
)

Could someone help me in figuring out why this is giving me correct values in some cases and not others, and how I can go about getting the correct values?

 
 
 
1 ACCEPTED SOLUTION

Hi @VSepaha ,

 

Sorry for the late reply.

Create a measure like this:

Measure = CALCULATE(AVERAGE('Table'[value]),ALLSELECTED('Table'))

V-lianl-msft_0-1601628343529.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
sanalytics
Super User
Super User

@ VSepaha,

It would be great if you provide us some sample data and your desired output..Providing only a screenshot is very difficult to assume your exact requirement..
if i understand correctly,your last two skill name are returning wrong average.So for that 

Avg Requested Number of Talent per Month = DIVIDE(SUM('Table'[Requested Number of Talent]),4)
can give you desire result..apart from that, I am unclear with your requirement.
 
regards,
sanalytics

 

The calculation you sent me does work correctly, however, I have a filter on the page which specifies the last X number of months. By default the number of months is set to 4. In that case,

"Avg Requested Number of Talent per Month = DIVIDE(SUM('Table'[Requested Number of Talent]),4)"

would work correctly. But if I changed the filter to the past 5 months, this formula would be invalid. Is there a way of how I can get the number of months being used by the filter?

@VSepaha,

Then use the Selectedvalue function for that..
Avg Requested Number of Talent per Month = DIVIDE(SUM('Table'[Requested Number of Talent]),

SELECTEDVALUE(ColumnName,Alternateresult))

Regards,

sanalytics

I'm still fairly new to Power BI, I'm not sure what goes in the Alternateresult value.

Would something like this work after I figure out the Alternateresult?

 

Avg Requested Number of Talent per Month = DIVIDE(SUM('Table'[REQUESTED_NUMBER_OF_TALENT]),
SELECTEDVALUE('Table'[Date].[Month], {Alternateresult})

 

Thanks again for the help!

 
 

Hi @VSepaha ,

 

Try:

Avg Requested Number of Talent per Month = DIVIDE(SUM('Table'[REQUESTED_NUMBER_OF_TALENT]),
DISTINCTCOUNT('Table'[Date].[Month])

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @V-lianl-msft 

 

This solution didn't seem to work for me. After applying this solution, it divided my 'Requested Number of Talent' by 12 instead of the number of months that I am filtering by.

Could you please help me find a solution that takes the filter into account?

 

Thank you!

Hi @VSepaha ,

 

Sorry for the late reply.

Create a measure like this:

Measure = CALCULATE(AVERAGE('Table'[value]),ALLSELECTED('Table'))

V-lianl-msft_0-1601628343529.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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