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

Calculation (average) of user ratings using only the latest rating from every respondent

Hello

 

I've been given the task of creating a "real time" rating dashboard of indidual and department workload per week.

 

Each employee has to rate their individual workload, after which I have to calculate the department's average workload. This part itself is pretty straightforward.

The problem is that the employees can continuously update their workload during the week if it changes. I therefore need the department's average workload to be calculated only on the basis of each person's most recent rating.

 

A simplified dataset could, for example, look like this:

 

NameRating    Date (dd-mm-yyyy)    Week
Alan       214-03-202311
Adam414-03-202311
Anna314-03-202311
Anna115-03-202311
Adam315-03-202311
Alan421-03-202312
Anna121-03-202312
Adam321-03-202312
Anna422-03-202312

 

For week 11 i need the average to be 2 based on every respondents latest rating (Alan 14-03-2023 = 2, Anna 15-03-2023 = 1, Adam 15-03-2023= 3), and not the average 2,6 based on all 5 values.

 

The same thing for week 12, where the average should be 3,6 based on the latest rating from each of the 3 respondents ratings and not 3 based on all 4 ratings.

 

How do i make this calculation?

 

I'm going to show the average value for the current week on one page, and on another page i will make a line-chart showing the development of the average rating for each week.

I'm using SQLBI's date template, so I do have a well populated date table.

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @ABech ,

 

Please try:

Average Workload =
AVERAGEX (
    FILTER (
        ALL ( 'Table' ),
        [Week] = MAX ( 'Table'[Week] )
            && [Date (dd-mm-yyyy)]
                = MAXX (
                    FILTER (
                        'Table',
                        [Week] = MAX ( 'Table'[Week] )
                            && [Name] = EARLIER ( 'Table'[Name] )
                    ),
                    [Date (dd-mm-yyyy)]
                )
    ),
    [Rating]
)

Final output:

vjianbolimsft_0-1678930871274.png

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @ABech ,

 

Please try:

Average Workload =
AVERAGEX (
    FILTER (
        ALL ( 'Table' ),
        [Week] = MAX ( 'Table'[Week] )
            && [Date (dd-mm-yyyy)]
                = MAXX (
                    FILTER (
                        'Table',
                        [Week] = MAX ( 'Table'[Week] )
                            && [Name] = EARLIER ( 'Table'[Name] )
                    ),
                    [Date (dd-mm-yyyy)]
                )
    ),
    [Rating]
)

Final output:

vjianbolimsft_0-1678930871274.png

Best Regards,

Jianbo Li

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

Hi @v-jianboli-msft 

 

Thank you so much. That seems to work to work perfect!

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.