cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmiraBedh
Super User
Super User

Get the max of the average for each group

I have the following table :

EmpId DeptId WeekNumber Month NumberofCalls

1         3           4                     1          34

2         3           2                      3         59

 

I created a measure to calculate the average of number of calls :

AvgCalls = AVG('MyTable'[NumberofCalls])

now I want to get the max average calls by month, week.

I will be having 3 filters :

  • Month
  • Week

Once I select all of them, the result in the histogram bar will be the employee having the max average calls.

 

1 ACCEPTED SOLUTION

Hi @AmiraBedh ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a measure as below to judge if the average of current employee is the max average:

Flag = IF ( [AvgCalls] = MAXX ( ALLSELECTED ( 'MyTable' ), [AvgCalls] ), 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1667270645215.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Community Support Team _ Rena
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

3 REPLIES 3
Greg_Deckler
Super User
Super User

@AmiraBedh This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

This is what I want  :

I select a month and in the histogram I want to return the week with maximum average, following your pattern, in the histogram when I select a month I am getting all the weeks but not only the week with lax average.

I used a TOP 1 filter on the histogram but I want to do it in dax

 

 

Hi @AmiraBedh ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a measure as below to judge if the average of current employee is the max average:

Flag = IF ( [AvgCalls] = MAXX ( ALLSELECTED ( 'MyTable' ), [AvgCalls] ), 1, 0 )

2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)

yingyinr_0-1667270645215.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.