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
gkaloferov
Frequent Visitor

Matrix visual: Averaging Year/Month results based on the average daily ones

Hello Community,

 

I have to calculate the average work done by a user per day, month and year. Therefore, I have the following table (actually it is a VIEW):

DATE / USER_ID / NAME (blurred due to privacy reasons) / TYPE / QUANTITY / COUNT_ITEM

pic4.jpg

 

The table has a relationship with a Calendar table.

 

The following calculations have to be done:

1. Calculate the sum of rows for a given day and which represents the work done by all users from different types. This is done by summing the column COUNT_ITEM since it summarizes the raw data and although it is not shown, there are rows where COUNT_ITEM numbers are greater than one.

 

The matrix below shows the first calculation per day, month and year. It is differentiated by the column TYPE (possible values are 1,2,3 and 4):

pic6.jpg

 

2. The second calculation is to consider the unique users who worked on a given day. Therefore, the DISTINCTCOUNT is applied to column USER_ID.

 

pic7.jpg

 

For example for date 13.11.2018 for TYPE "1 "the results are: 529 rows processed by 3 unique users.

 

3. Third calculations: Finding the average rows processed by а given user or otherwise: SUM(COUNT_ITEM)/DISTINCTCOUNT(USER_ID).

 

pic8.jpg

 

For example: for the date 13.11.2018 for TYPE "1 "the average result is about 176.33, for type 2 on the same date the average result is 197.25 and so on. These results are correct, however the monthly and annual ones are biased.

For example, in November for TYPE 2 the results are as follows:

 

pic9.jpg

7040 rows processed by 6 unique users which is equal to 1173.33 on average. However, the number 6 is biased due to the following reason: one user on a given day may be type 1, and another day is type 2, and so on. Although 6 unique users have worked throughout November, on а daily basis, six users have worked only on November 8th, but during the rest of the time - four to five. Therefore, 1173,33 is not the correct monthly average. The correct would be: Averaging the daily users and then dividing the sum of count items on it.

 

For example:

On average the users worked in November (for type 2) are:

4.555555556

 

7040 count items divided by 4.555555556 is approximately equal to 1545.36.

 

So my question is: How to average monthly/annual (subtotals) and totals results based on daily results.

 

I tried many different approaches: quick measures, AVERAGEX, variables for the daily results which are then submitted as an argument for the monthly results. No results at all and I am in a deadlock.

 

Thank you in advance.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

I believe that the Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

I believe that the Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you very much!! You're the best!

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.