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
Anonymous
Not applicable

How to Calculate Average While Keeping One Filter

The selected value of Employee ID from filter shows a Department value in the text label for Department field.

The ask is now to calculate the average of performance ID for the whole department of the employee.
My calculation below seems to be failing please advise

It's a single table "Data" where every field resides

GauravGG_0-1647906093282.png

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous try this measure

 

Dept Performance = 

VAR __deptId = MAX ( Data[Department ID])
RETURN
 AVERAGEX (
     FILTER ( 
        ALL ( Data ), 
        Data[Department ID] =__deptId 
    ) , 
    CALCULATE ( SUM(Data[Performance ID] ) )
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

11 REPLIES 11
parry2k
Super User
Super User

@Anonymous try this measure

 

Dept Performance = 

VAR __deptId = MAX ( Data[Department ID])
RETURN
 AVERAGEX (
     FILTER ( 
        ALL ( Data ), 
        Data[Department ID] =__deptId 
    ) , 
    CALCULATE ( SUM(Data[Performance ID] ) )
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous where is the link?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

AM sorry Parry, updated my last post- it has the link now
Lmk if it doesn't work

Anonymous
Not applicable

@Ashish_Mathur , @johnt75 , @parry2k 
Shairng the file link- if you can please have a look and help
https://drive.google.com/file/d/1xkK35yYfZ_Opyg9vJKbUMQXni_2Nlc9Q/view?usp=sharing

Hi,

Based on the file that you have shared, the answer should be 4.  Try these measures:

Department of selected employee = MAX(Data[Department])
Dept Performance = calculate(average(Data[performance id]),FILTER(VALUES(Data[Department]),Data[Department]=[Department of selected employee]))
/*CALCULATE(AVERAGEX(Data,Data[Performance ID]),SELECTEDVALUE(Data[Department])
CALCULATE( AVERAGE(Data[Performance ID]),KEEPFILTERS(SELECTEDVALUE(Data[Department])))*/

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
johnt75
Super User
Super User

Try

Department Average =
var currentDepartment = SELECTEDVALUE('Employee'[Department])
return CALCULATE( AVERAGE( 'Data'[Performance ID]), 'Data'[Department] = currentDepartment )
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

=calculate(average(Data[performance id]),all(Data[Employee ID]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

This is still showing the answer as 2.98 as shown below, whichj is the overall average irrespective of department

GauravGG_1-1647919530739.png

The answer should be 3.09 (Per Pivot Below) for Software Engineering Department Performance average

GauravGG_2-1647919623558.png

 

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@parry2k Sir, this is giving me the average of all the dataset- I want to limit it to give average of Performance ID of the department for of the selected employee ID
The dataset is a single table.
Please help again if possible

parry2k
Super User
Super User

@Anonymous try this:

 

CALCULATE ( AVERAGE ( Data[Performance Id] ), REMOVEFILTERS ( Table[Employee Id] ), VALUES ( Data[Department] ) ) 

 it might need tweaking because not sure how the model looks like

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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