I created a dummy dataset based on your question. Based on what I understood, I used a calculated field using 'IF' and 'ELSEIF' to address your need. In the attached workbook, you will see that for D and F the sum of profit is only calculated for location 21 and for the rest it is calculated regardless of the location. I hope this answers your question.
Kevin's Question.twbx 10.9 KB