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

DAX Formula For Averages per week static per person

Hi there

 

I'm trying to calulcate an average figure (simple usually). However this figure needs to be based on a calculation of overall per year then drill to month and then drill to week. So against every person for those drill periods I want the average to be the same against each person. Then if the average changes the following week I want the new average figure to be the same for every person. I can then create a conditional format against it. 

 

The DAX I have created works on a card visual level when I select a particular week, but as soon as I drop it in to my table where all the user names and years/months/weeks are listed the figure changes

 

E.G Week 45 card visual saya 29.57 but when I add it to the table it breaks down like this (column highlighted in yellow)

KarenFingerhut_0-1634190442353.png

 

In that table are weeks for the last 12 months. As you can see the total for the column is correct at 29.57 but I just cant get it to work against each individual person.

 

My DAX is 

# Dynamic Average = CALCULATE(AVERAGEX(FILTER(ALLSELECTED(Activity), Activity[fiscal_week_processing_date] <= MAX(Activity[fiscal_week_processing_date])),SUM(Activity[Cases worked])/SUM(Activity[Days worked])))
 
Hope this makes sense!
 
Can someone please help.
 
Thank you
 
Kind regards
Karen

 

 

1 ACCEPTED SOLUTION

HI there

 

I managed to resolve the issue by using this

 

Dax 1
CALCULATE(DIVIDE(SUM(Activity[Cases worked]),SUM(Activity[Days worked])))
 
Dax 2
CALCULATE ([# Average Cases Worked],ALLSELECTED(Activity))
 
What these do is,  Dax 2 enables the card visual 'Overall Daily Average' to change when a fiscal week or month is selected and then Dax 1 is used against each indivisual to see the % difference between their average and the overall average
 
KarenFingerhut_0-1634533539615.png

Thanks for getting back to me

 

Kind regards

Karen

 

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

You are using CALCULATE without a filter context modifier.  Is that intended?

 

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. 

HI there

 

I managed to resolve the issue by using this

 

Dax 1
CALCULATE(DIVIDE(SUM(Activity[Cases worked]),SUM(Activity[Days worked])))
 
Dax 2
CALCULATE ([# Average Cases Worked],ALLSELECTED(Activity))
 
What these do is,  Dax 2 enables the card visual 'Overall Daily Average' to change when a fiscal week or month is selected and then Dax 1 is used against each indivisual to see the % difference between their average and the overall average
 
KarenFingerhut_0-1634533539615.png

Thanks for getting back to me

 

Kind regards

Karen

 

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.