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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
echobase
Frequent Visitor

Attendance report - If is blank lookup?

Greetings and thank you in advance for any help with this!

 

I am having trouble coming up with a solution to the creation of an attendance status report.  The goal is to see which students did or did not attend class on any  given day.  I have two tables that I am working with.  Table 1 is the student schedule, which contains the days each student is scheduled to attend.

 

 Screen Shot 2022-03-10 at 12.58.13 PM.png

 

Table 2 is the student attendance, which contains the days each student was present and account for in school.  

 

Screen Shot 2022-03-10 at 12.59.57 PM.png

 

The result I would like is a new column or a new table that shows the attendance

 

Screen Shot 2022-03-10 at 1.08.34 PM.png

 

I was trying If(ISBLANK(LOOKUPVALUE, however, I have not figured out how to incorporate looking at each date.  Does that anyone have some thoughts on this?  Thanks again in advance for any help with this!!

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @echobase 

 

Try this measure:

 

 

Attended = 
VAR _A =
    FILTER (
        'student attendance',
        'student attendance'[StudentID] = MAX ( 'student schedule'[StudentId] )
            && 'student attendance'[AttendedDate] = MAX ( 'student schedule'[ScheduleDate] )
    )
RETURN
    IF ( COUNTROWS ( _A ) = 0, "No", "Yes" )

 

 

 

Output:

 

VahidDM_0-1646949174633.png

 

 

 

sample file attached.

If you want a calculated column, try this in Student Schedule table:

 

Attended Column = 
VAR _A =
    FILTER (
        'student attendance',
        'student attendance'[StudentID] = EARLIER(  'student schedule'[StudentId] )
            && 'student attendance'[AttendedDate] = EARLIER( 'student schedule'[ScheduleDate] )
    )
RETURN
    IF ( COUNTROWS ( _A ) = 0, "No", "Yes" )

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

4 REPLIES 4
bcdobbs
Community Champion
Community Champion

If your attendance table is large I'd move the logic into Power Query.

 

Merge the two tables on StudentId and Date. Expand the result and replace not nulls with 1 and nulls with 0.

 

I'd also then reference your original schedule table and create a student dimension by removing all columns apart from name and student id. Then use remove duplicates.


I'll send a demo in morning.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
VahidDM
Super User
Super User

Hi @echobase 

 

Try this measure:

 

 

Attended = 
VAR _A =
    FILTER (
        'student attendance',
        'student attendance'[StudentID] = MAX ( 'student schedule'[StudentId] )
            && 'student attendance'[AttendedDate] = MAX ( 'student schedule'[ScheduleDate] )
    )
RETURN
    IF ( COUNTROWS ( _A ) = 0, "No", "Yes" )

 

 

 

Output:

 

VahidDM_0-1646949174633.png

 

 

 

sample file attached.

If you want a calculated column, try this in Student Schedule table:

 

Attended Column = 
VAR _A =
    FILTER (
        'student attendance',
        'student attendance'[StudentID] = EARLIER(  'student schedule'[StudentId] )
            && 'student attendance'[AttendedDate] = EARLIER( 'student schedule'[ScheduleDate] )
    )
RETURN
    IF ( COUNTROWS ( _A ) = 0, "No", "Yes" )

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Wonderful!  Thank you for taking the time and providing a detailed reponse and the .pbix example.  Very useful and appreciated.  I used the example file and was able to reproduce the same in the actual report.  It was great to have the example file as I could confirm things like the relationships and the auto date time setting to have a true Apples to Apples comparison.   I was able to make some variations as well, thanks to your work!  Thanks again!

jdbuchanan71
Super User
Super User

@echobase 

You can add a column to your schedule table that looks for the StudentID and Date in question like this.

 

Attended =
IF (
    ISBLANK (
        LOOKUPVALUE (
            Atendance[StudentID],
            Atendance[StudentID], Schedule[StudentID],
            Atendance[AttendDate], Schedule[ScheduleDate]
        )
    ),
    "No",
    "Yes"
)

The column we lookup against doesn't matter really, it just checking if there is a row for that student / date in the attendance table.

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.