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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Average of values on specific dates only

 

Hey cummunity,

 

I am trying to calculate the average of GAV, but it has to count only the values of GAV on the last day of every month in the selected range (see picture below). The rusult I am getting is slightly of.

Screenshot 2021-06-27 121330.png


According to my calaculations it should be  299 174 307,14 for year 2020 and 326 112 602,05 for 2021. The formula I am using is:
 

Average GAV =

VAR MaxMonth = CALCULATE(MAX(Dates[MonthNum]), ALL(Dates), Dates[CurMonthOffset] = 0)

RETURN

CALCULATE(AVERAGEX( VALUES(Dates[EndOfMonth]), [GAV] ), Dates[MonthNum] <= MaxMonth, FILTER(Dates, ALLSELECTED(Dates[Year])), ALL('IslaiduLentele Map'))

 

 Do you have any suggestions on how I could change it ?

 

I am ataching an example PBI file and my gratitude :

https://www.dropbox.com/s/52co15sbnqnk0ka/Example4.pbix?dl=0

1 ACCEPTED SOLUTION

OK @Anonymous 

but when year=2020, avg should be 24931192.2616667 (Not 27 197 664,29)  if your expected data could be accurate, then we can work on it quickly.🤣  FYI: https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1579748#M642005

-

use the measure bellow,

 

Measure_average =
VAR _count =
    CALCULATE ( DISTINCTCOUNT ( Dates[EndOfMonth] ), ALLSELECTED ( Dates ) )
VAR _sum =
    SUMX ( SUMMARIZE ( Dates, Dates[EndOfMonth], "s1", [GAV] ), [s1] )
RETURN
    _sum / _count

 

result:

vxiaotang_0-1625120432135.pngvxiaotang_1-1625120445074.png

 

Best Regards,

Community Support Team _ Tang

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

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

The description of the problem is not very clear. 

year=2021,  AVG=326 112 602,05;

year=2020,  AVG=299 174 307,14; 

but how is this calculated? please let me know whose average you want to calculate.

the average value of the data in the picture is... Obviously it's not the result you want. so please put the true picture with data where your average comes from.

vxiaotang_0-1624945670201.png

FYI:

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1579748#M642005

 

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.

Anonymous
Not applicable

Thank you for your answer and patience 🙂 

The range described in the picture is correct, what is wrong is the expected values I sent you. 

year=2021,  AVG = 27 176 050,17;

year=2020,  AVG = 27 197 664,29;

Sory for the mistake.



OK @Anonymous 

but when year=2020, avg should be 24931192.2616667 (Not 27 197 664,29)  if your expected data could be accurate, then we can work on it quickly.🤣  FYI: https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1579748#M642005

-

use the measure bellow,

 

Measure_average =
VAR _count =
    CALCULATE ( DISTINCTCOUNT ( Dates[EndOfMonth] ), ALLSELECTED ( Dates ) )
VAR _sum =
    SUMX ( SUMMARIZE ( Dates, Dates[EndOfMonth], "s1", [GAV] ), [s1] )
RETURN
    _sum / _count

 

result:

vxiaotang_0-1625120432135.pngvxiaotang_1-1625120445074.png

 

Best Regards,

Community Support Team _ Tang

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.