Forum Discussion
Anonymous
2 years agoNot applicable
Lookupvalue two tables with multiple criteria
I have below two tables.
I try to calculate the column "Column to Calculate" using 'Tabel1' [Cost Group] to lookup in 'Tabel2' [Cost Group] and 'Tabel2' [Account] with only ABC1 and ABC2.
The IN does not really work so looking for other ways.
Tabel1:
| Cost Group | Column to Calculate |
| ID 1 | Lookupcalue('Tabel2'[Costs], 'Tabel2'[Cost Group], 'Tabel1'[Cost Group], 'Tabel2', IN {"ABC1", "ABC2"}) =3000 |
| ID 2 | |
| ID 3 | |
| ID 4 | |
| ID 5 |
Tabel 2:
| Cost Group | Account | Costs |
| ID 1 | ABC1 | 1000 |
| ID 1 | ABC2 | 2000 |
| ID 1 | ABC3 | 3000 |
| ID 2 | ABC1 | 500 |
| ID 2 | ABC2 | 1000 |
| ID 2 | ABC3 | 2000 |
Hello Anonymous,
Can you please try this DAX:
Column to Calculate = CALCULATE( SUM('Table2'[Costs]), FILTER( 'Table2', 'Table2'[Cost Group] = 'Table1'[Cost Group] && ('Table2'[Account] = "ABC1" || 'Table2'[Account] = "ABC2") ) )Should you require any further assistance, please do not hesitate to reach out to me.
2 Replies
- Sahir_MaharajSuper User
Hello Anonymous,
Can you please try this DAX:
Column to Calculate = CALCULATE( SUM('Table2'[Costs]), FILTER( 'Table2', 'Table2'[Cost Group] = 'Table1'[Cost Group] && ('Table2'[Account] = "ABC1" || 'Table2'[Account] = "ABC2") ) )Should you require any further assistance, please do not hesitate to reach out to me.
- AnonymousNot applicable
Sahir_Maharaj Thank you! Works so well!