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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.