Forum Discussion
dgenatossio
8 years agoFrequent Visitor
Sum the Values in Table B IF Table A Meets Criteria
I have 3 tables. One is a table with employee IDs (Table 'ID'). One is a table with employee IDs and their 2017 sales for one business (Table 'A'). The third table has employee IDs and their 2017 sal...
dgenatossio
8 years agoFrequent Visitor
I changed my data structure by appending B data to A data in order to create one table that has two columns, one for A sales and one for B sales. I want to write a formula that will sum A sales if B sales for the employee are greater than 0. It should be dynamic so that if I change the month, the formula will calculate only for that month.
The Employee ID table is connected to the sales Table through 'Employee ID'
| Employee ID | Month | A Sales | B Sales | Company |
| 1 | 1 | 10 | 0 | A |
| 1 | 2 | 20 | 0 | A |
| 1 | 3 | 10 | 0 | A |
| 2 | 2 | 5 | 0 | A |
| 3 | 6 | 20 | 0 | A |
| 3 | 9 | 25 | 0 | A |
| 4 | 2 | 10 | 0 | A |
| 4 | 7 | 10 | 0 | A |
| 4 | 9 | 10 | 0 | A |
| 4 | 10 | 5 | 0 | A |
| 5 | 2 | 10 | 0 | A |
| 5 | 3 | 30 | 0 | A |
| 5 | 6 | 25 | 0 | A |
| 3 | 2 | 0 | 10 | B |
| 3 | 6 | 0 | 20 | B |
| 4 | 7 | 0 | 10 | B |
| 4 | 10 | 0 | 15 | B |
| Employee ID |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
v-yuta-msft
Community Support
8 years agoHi dgenatossio,
Your requirement is to create a slicer based on Table[Month] column and create a measure using DAX like this:
Result = CALCULATE(SUM(Table1[A Sales]), ALLSELECTED(Table1[Month]), Table1[B Sales] > 0)
Regards,
Jimmy Tao