Forum Discussion
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)
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#M902051
5 Replies
- Samarth_18
Community Champion
Hi Reddyp ,
Please try this:-
CALCULATE ( SUM ( Sheet1[sales] ), FILTER ( Sheet1, Sheet1[Year] = 2020, FILTER ( Sheet2, Sheet2[Location] = "Auckland" ) )Thanks,
Samarth
- danextian
Super User
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#M902051