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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SamOvermars
Helper I
Helper I

How can I get a count that involves two tables?

Hello,

I cant find a way to get this to work but it sounds simple.
I have the following tables.

AttendedTable

SamOvermars_0-1665096176455.png

 

 

AbsentTable

SamOvermars_1-1665096214202.png

 

 


AllUsersTable - Which contains the users and the sections they belong to

SamOvermars_2-1665096265640.png

 

 

I have a one-to-one relationship between AbsentTable and AttendedTable using the SectionKey

I want to populate the absent column in the absent table by counting how many users (UserID) minus the number of attended people (Attendee) for each section. This should give me the number of absents from each section. I tried to use count (UserID), but it gave me the overall count in that table. Which is not what I need.
How Can I do that?

1 ACCEPTED SOLUTION
hnguy71
Memorable Member
Memorable Member

@SamOvermars ,

 

Try this:

VAR _UserSection = CALCULATE(COUNTROWS(AllUsers), FILTER(AllUsers, AllUsers[UserSection] = [Section]))
VAR _UserAttended = CALCULATE(SUM(Attended[Attendee]), FILTER(Attended, Absent[SectionKey] = Attended[SectionKey]))

RETURN

_UserSection - _UserAttended


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

1 REPLY 1
hnguy71
Memorable Member
Memorable Member

@SamOvermars ,

 

Try this:

VAR _UserSection = CALCULATE(COUNTROWS(AllUsers), FILTER(AllUsers, AllUsers[UserSection] = [Section]))
VAR _UserAttended = CALCULATE(SUM(Attended[Attendee]), FILTER(Attended, Absent[SectionKey] = Attended[SectionKey]))

RETURN

_UserSection - _UserAttended


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.