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! Learn more

Reply
newpi
Helper V
Helper V

Avg calculation showing unselected rows & their blank values

I'm using an avg formula to calculate the avg of avg. It may not be the best way but that is the requirement at the moment. My problem is when I select a group of users out of a larger group, it is also showing me other users but with all blank values except in the group avg column. My data looks like below:

 

User nameTotal HoursTotal DaysUser Avg hours/dayGroup avg Hours/day
U 18187
U 230567
U 3   7
U 4   7
U 5   7

 

Group Avg Hours/Day = 

CALCULATE(AVERAGEX(ALLSELECTED('Tabel Name'[User Name]),[Avg Hours / Day]))
 
U1 & U2 are part of group A which I'm selecting though a slicer.
Avg of group A is (Avg hours U1+ Avg hours U2)/2
 
I want my table to not show other users which are not a part of this group (U3 to U5)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@newpi , Need to try like

CALCULATE(AVERAGEX(values('Tabel Name'[User Name]),[Avg Hours / Day]))

or

AVERAGEX(summarize('Tabel Name','Tabel Name'[User Name],"_1",[Avg Hours / Day]),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@newpi , Need to try like

CALCULATE(AVERAGEX(values('Tabel Name'[User Name]),[Avg Hours / Day]))

or

AVERAGEX(summarize('Tabel Name','Tabel Name'[User Name],"_1",[Avg Hours / Day]),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak The second formula works great.

AVERAGEX(summarize('Tabel Name','Tabel Name'[User Name],"_1",[Avg Hours / Day]),[_1])

However, If I apply it to a line and stacked column chart, it is showing me individual averages instead of team avgas my columns value has indvidual avg.  Attached screenshot. Blue line is the avg which should be 7.07 for both in this case.Screen Shot 2020-08-13 at 10.02.52 PM.png 

v-yingjl
Community Support
Community Support

Hi @newpi ,

You can modify the measure like this:

Group avg hours/day =
VAR tab =
    SUMMARIZE ( ALL ( 'Table' ), 'Table'[User name], "_1", [User Avg hours/day] )
RETURN
    IF ( NOT ( ISBLANK ( SUM ( 'Table'[Total Hours] ) ) ), AVERAGEX ( tab, [_1] ) )

avergae.png

Attached a sample file that hopes to help you: average.pbix

 

Best Regards,
Yingjie Li

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

@Anonymous the table I showed in my example is the output and except Total hours, all other columns are DAX measures. So can't use Average or ALLEXCEPT in this case. 

@amitchandak Would you be able to help here with the Column line and stacked view and the average formula?

Anonymous
Not applicable

Hi @newpi 

 

Group Avg Hours/Day = 

CALCULATE(AVERAGE('Tabel Name',[Avg Hours / Day],ALLEXPECT('Tabel Name','Tabel Name'[User Name])))
 

Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

Helpful resources

Announcements
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!

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.

Top Solution Authors