cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
AmiraBedh
Solution Sage
Solution Sage

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.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
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

 

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors