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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate conditional average (with group by?)

Hi!

 

I want to calculate a conditional average based on a measure, very similar to a question I already asked: https://community.powerbi.com/t5/Desktop/Calculate-conditional-average/m-p/1270531

 

This solution works fine, but this time I have a measure like this : Performance_Sum = COUNT(Table[Performance]), where Performance is a column with a few different values like "Calls", "Start Campagin", "Build Website" etc.

 

The above solution works perfectly fine for a measure with just one distinct value, but if apply this solution to the Performance_Sum measure I  get the average for employees where the sum of Performance_Sum is greater than 1 but thats not what I want. So if an employee got 0 "Calls" but 3 "Start Campaign" he will be taken into account for the average of calls as well because "Performance_Sum" >1 but he should be excluded for the average of "Calls" and included for "Start Campaign".

I think I need to group by, but I dont really know who to apply this to the above solution.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Not very clear.

But you need to have something like this

AverageX(filter(Summarize(Table, Table[employee], "_call" , [calls] ,"_ps" ,[Performance_Sum]),[_call] >0 && [_ps]>1),[_ps])

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

I think summarize function should work for your scenario, can you please share some dummy data with the expected result to help us clarify your datastore and do test coding format on it?

How to Get Your Question Answered Quickly 

In addition, you can also take a look at the following blog if you are processing the calculation on the subtotal level:

Clever Hierarchy Handling in DAX 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Not very clear.

But you need to have something like this

AverageX(filter(Summarize(Table, Table[employee], "_call" , [calls] ,"_ps" ,[Performance_Sum]),[_call] >0 && [_ps]>1),[_ps])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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