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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
MCacc
Helper IV
Helper IV

Calculate a sum with filter from another page

Hello, 

I'm trying to calculate a sum where is filtered for the max day I can find in my period of dates. The issue is, my filter condition comes from another table. 

I tried this:

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;RELATED(TABLE2[DAYS_PERIOD]) = MAX(TABLE2[DAYS_PERIOD])))
 
And it gives me this error message:
"The column 'TABLE2[DAYS_PERIOD]' either doesn't exist or doesn't have a relationship to any table available in the current context."
 
But the tables are indeed connected
 
Do you guys have any idea why this happens?
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @MCacc 

Do you want to create a calculate column or a measure?

If you want to create a measure, Just adjust the formula as below:

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;TABLE2[DAYS_PERIOD] = MAX(TABLE2[DAYS_PERIOD])))

 

If you want to create a column, this formula need to used in TABLE1, In TABLE2, adjust the formula as below:

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;TABLE2[DAYS_PERIOD]=MAX(TABLE2[DAYS_PERIOD])))
 
Regards,
Lin
Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi  @MCacc 

Do you want to create a calculate column or a measure?

If you want to create a measure, Just adjust the formula as below:

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;TABLE2[DAYS_PERIOD] = MAX(TABLE2[DAYS_PERIOD])))

 

If you want to create a column, this formula need to used in TABLE1, In TABLE2, adjust the formula as below:

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;TABLE2[DAYS_PERIOD]=MAX(TABLE2[DAYS_PERIOD])))
 
Regards,
Lin
Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Try like

TOTAL= CALCULATE(SUM(TABLE1[HRS]);FILTER(TABLE2;(TABLE2[DAYS_PERIOD]) = MAX(TABLE2[DAYS_PERIOD])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.