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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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))
v-heq-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.