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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Reddyp
Helper I
Helper I

Filter on columns from two different tables

Hi, I need to calculate SUM of (Sheet1)sales where (Sheet1)YEAR is 2020 and LOCTION is (Sheet2)AUCKLAND

the "location" is present on the other table (Sheet 2)

1 ACCEPTED SOLUTION

I missed something. Please try this:

2020 Auckland = 
CALCULATE (
    SUM ( Sheet1[Value] ),
    FILTER ( Sheet1, Sheet1[Year] = 2020 && RELATED ( Sheet2[Location] ) = "Auckland" )
)

You may refer to this PBIX with a mock up data: https://drive.google.com/file/d/16v71ZONREaPauBzUTYvMIScFu8IwCc9u/view?usp=sharing 

If this doesn't work, please share a pbix with sanitized data.

 

Here's how you can get your questions answered quickly - https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/2547186#M9020... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
Samarth_18
Community Champion
Community Champion

Hi @Reddyp ,

 

Please try this:-

CALCULATE (
    SUM ( Sheet1[sales] ),
    FILTER ( Sheet1, Sheet1[Year] = 2020,
    FILTER ( Sheet2, Sheet2[Location] = "Auckland" )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

danextian
Super User
Super User

Hi @Reddyp ,

 

Assuming there is is a one-to-many realtionship between Sheet2[LocationColumn] and Sheet1[LocationColumn],  this measure should work:

My Measure =
CALCULATE (
    SUM ( Sheet1[Sales] ),
    FILTER ( Sheet1, Sheet1[Year] = 2020 && Sheet2[Location] = "Auckland" )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian  its not   one-to-many , Its many - to -One realtionship between Sheet2[LocationColumn] and Sheet1[LocationColumn]

and as you said this didn't work, please help me out

Hi @Reddyp

Have your problem been solved? If so, please share your solution so that if someone else has the same problem as you, he can get the answer quickly.

 

If not, please try to change the relationship between sheet1 and sheet2 and set the cross filter direction as both.

vchenwuzmsft_0-1654679347378.png

 

Then use the code provided by @Samarth_18 . 

 

CALCULATE (
SUM ( Sheet1[sales] ),
FILTER ( Sheet1, Sheet1[Year] = 2020,
FILTER ( Sheet2, Sheet2[Location] = "Auckland" )
)
 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I missed something. Please try this:

2020 Auckland = 
CALCULATE (
    SUM ( Sheet1[Value] ),
    FILTER ( Sheet1, Sheet1[Year] = 2020 && RELATED ( Sheet2[Location] ) = "Auckland" )
)

You may refer to this PBIX with a mock up data: https://drive.google.com/file/d/16v71ZONREaPauBzUTYvMIScFu8IwCc9u/view?usp=sharing 

If this doesn't work, please share a pbix with sanitized data.

 

Here's how you can get your questions answered quickly - https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/2547186#M9020... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors