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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
dkernen2
Helper II
Helper II

Create a DAX measure that counts summarized hours to date compared to a target

I have a list of students who are submitting internship hours.  I need a measure that calculates their hours-to-date spent compared to the hours-to-date target.  I have been able to create a metric that shows the ratio, but I am struggling creating a metric that counts the number of students that are on/below/above target to date.  I've tried SUMMARIZECOLUMNS but that isn't meeting my needs.  

I have, by student

CoachStudentHours to DateTarget to DateRatio
AAStudentA10575140%
BBStudentB8975119%
BBStudentC617581%

 

What I need is to create measures that calculate counts by coach

CoachStudentsHours to DateTarget to DateStudents Behind TargetStudents At or Above Target
AA11057501
BB215015011


Any help you can provide would be most appreciated.  Sample file is here.

1 ACCEPTED SOLUTION
dkernen2
Helper II
Helper II

I am thinking this should work:

Behind Target = COUNTROWS(FILTER(VALUES(Attendance[Student ID]),[Total to Target To Date]<1))

View solution in original post

3 REPLIES 3
dkernen2
Helper II
Helper II

I am thinking this should work:

Behind Target = COUNTROWS(FILTER(VALUES(Attendance[Student ID]),[Total to Target To Date]<1))
Anonymous
Not applicable

Hi @dkernen2 ,

vheqmsft_1-1706166305313.png

1.Create two measures to calculate diffierernt types

Students At or Above Target =
VAR Students =
    COUNTROWS ( VALUES ( 'Table'[Student] ) )
VAR AtOrAboveTarget =
    COUNTROWS (
        FILTER ( 'Table', 'Table'[Hours to Date] >= 'Table'[Target to Date] )
    )
RETURN
    AtOrAboveTarget
Students Behind Target =
VAR Students =
    COUNTROWS ( VALUES ( 'Table'[Student] ) )
RETURN
    Students - [Students At or Above Target]

2.Create calculate table

Coach =
SUMMARIZE (
    'Table',
    'Table'[Coach],
    "Students", COUNTROWS ( VALUES ( 'Table'[Student] ) ),
    "Hours to Date", SUM ( 'Table'[Hours to Date] ),
    "Target to Date", SUM ( 'Table'[Target to Date] ),
    "Students Behind Target", [Students Behind Target],
    "Students At or Above Target", [Students At or Above Target]
)

3.Final output

vheqmsft_2-1706166479927.png

 

Best regards

Albert He

 

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

Thank you Albert.  Your solution requires a pre-aggregated table of hours to date, which I do not have.  My attendance table has daily rows.  I need to summarize the hours to date by student with the original table that has multiple attendance rows per student.  Any thoughts?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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