Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Domenick
Helper IV
Helper IV

Evaluating by group and delivering average score

I'm trying to calculate average employee performance. For the sake of making this easier to explain, lets say employees have a number of tasks they need to complete weekly. The completion of those tasks is denoted weekly with a Yes (Y) or No (N). My intended result is the percentage of weeks where the employee completed all of the tasks. 

 

So I need to evaluate each group of tasks by date (I figure a 1 if all tasks are complete, a 0 if not all tasks are complete) and then I need to average those (which is the easy part). I've tried to illustrate that flow below:

Domenick_1-1658779994152.png

The part that I'm stuck on is evaluating each employees completion by date. I figure once I can get past that, averaging those ones and zeros will be easy.

 

Anyone have a good approach? It's probably very simple, and my brain is just fried.

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Domenick 
Please try

Score =
VAR SummaryTable =
    SUMMARIZE (
        Performance,
        Performance[Employee],
        Performance[Date],
        "@Completed", IF ( ISEMPTY ( FILTER ( Performance, Performance[Task] = "N" ) ), 1, 0 )
    )
RETURN
    AVERAGEX ( SummaryTable, [@Completed] )

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Domenick 
Please try

Score =
VAR SummaryTable =
    SUMMARIZE (
        Performance,
        Performance[Employee],
        Performance[Date],
        "@Completed", IF ( ISEMPTY ( FILTER ( Performance, Performance[Task] = "N" ) ), 1, 0 )
    )
RETURN
    AVERAGEX ( SummaryTable, [@Completed] )

Thanks! It's not producing the correct result. I'm trying to figure out why. 

I got it to work! Thank you so much. Your code works brilliantly! 😊

@Domenick 
Try this please

Score =
VAR SummaryTable =
    SUMMARIZE (
        Performance,
        Performance[Employee],
        Performance[Date],
        "@Completed", IF ( ISEMPTY ( CALCULATETABLE( Performance, Performance[Task] = "N" ) ), 1, 0 )
    )
RETURN
    AVERAGEX ( SummaryTable, [@Completed] 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.