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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Power-User
Frequent Visitor

RELATEDTABLE with ALL

Hi,

 

I am trying to add ALL() into the DAX statment to get the total present marks in the attendance table only were they match in the pupil table. I have a primary key link between the 2 tables.

I need the total present marks to not change if a filter is used.

 

CALCULATE(SUM('Attendance (Table)'[Present]),ALL('Attendance (Table)'),RELATEDTABLE('Pupil (Table)'))
 
Any help greatly appreciated.
 
Many tahks
 
Chris
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Power-User ,

From your description, it seems like you want to ignore any filters that might be applied to the 'Attendance (Table)' while still maintaining the relationship with the 'Pupil (Table)'. To achieve this, you should use the `ALL` function to remove filters from the 'Attendance (Table)' and then use `RELATEDTABLE` to bring in the related data from the 'Pupil (Table)'. However, the `RELATEDTABLE` function is typically used to create a one-to-many relationship in the opposite direction, from the one side to the many side.

Here's a step-by-step action plan to correct your DAX formula:
1. Understand the Data Model: Ensure that the relationship between 'Attendance (Table)' and 'Pupil (Table)' is correctly set up with a primary key in the 'Pupil (Table)' that uniquely identifies each pupil.


2. Modify the DAX Formula: You'll want to use the `CALCULATE` function to sum the present marks, remove filters from the 'Attendance (Table)' using `ALL`, and ensure that the relationship with the 'Pupil (Table)' is maintained.


3. Your DAX formula should look something like this:

TotalPresentMarks =
CALCULATE (
    SUM ( 'Attendance (Table)'[Present] ),
    ALL ( 'Attendance (Table)' )
)

This formula will calculate the total present marks regardless of any filters applied to the 'Attendance (Table)'.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Power-User ,

From your description, it seems like you want to ignore any filters that might be applied to the 'Attendance (Table)' while still maintaining the relationship with the 'Pupil (Table)'. To achieve this, you should use the `ALL` function to remove filters from the 'Attendance (Table)' and then use `RELATEDTABLE` to bring in the related data from the 'Pupil (Table)'. However, the `RELATEDTABLE` function is typically used to create a one-to-many relationship in the opposite direction, from the one side to the many side.

Here's a step-by-step action plan to correct your DAX formula:
1. Understand the Data Model: Ensure that the relationship between 'Attendance (Table)' and 'Pupil (Table)' is correctly set up with a primary key in the 'Pupil (Table)' that uniquely identifies each pupil.


2. Modify the DAX Formula: You'll want to use the `CALCULATE` function to sum the present marks, remove filters from the 'Attendance (Table)' using `ALL`, and ensure that the relationship with the 'Pupil (Table)' is maintained.


3. Your DAX formula should look something like this:

TotalPresentMarks =
CALCULATE (
    SUM ( 'Attendance (Table)'[Present] ),
    ALL ( 'Attendance (Table)' )
)

This formula will calculate the total present marks regardless of any filters applied to the 'Attendance (Table)'.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors