Hello all;
I'm having trouble figuring out how to formulate the correct DAX formula - if that's what I need. Below is a really simplified example of what I'm trying to achieve. I have two different sources of budget information and used power pivot to get them to line up by creating an index table and linking it to two other tables that each have different budgets for the same task. There are hundreds of rows in each of the tables and there can be multiple lines with the same "business unit" and "cost code" combination. In excel I would use sumproduct as done in the example below. Essentially, I want to be able to find the variance between two numbers based on multiple rows that meet certain criteria. If anyone can point me in the right direction such as possible nesting combinations or other formulas it would be greatly appreciated. I'm pretty new to DAX.
Thanks,
Dman333
I'm having trouble figuring out how to formulate the correct DAX formula - if that's what I need. Below is a really simplified example of what I'm trying to achieve. I have two different sources of budget information and used power pivot to get them to line up by creating an index table and linking it to two other tables that each have different budgets for the same task. There are hundreds of rows in each of the tables and there can be multiple lines with the same "business unit" and "cost code" combination. In excel I would use sumproduct as done in the example below. Essentially, I want to be able to find the variance between two numbers based on multiple rows that meet certain criteria. If anyone can point me in the right direction such as possible nesting combinations or other formulas it would be greatly appreciated. I'm pretty new to DAX.
Thanks,
Dman333
Book2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Budget #1 Internal | Budget #2 External | Bus Unit Summary | |||||||||
2 | ||||||||||||
3 | Business Unit | Cost Code | Budget | Business Unit | Cost Code | Budget | Bus Unit | Variance | ||||
4 | ||||||||||||
5 | 100 | 20001 | 100 | 100 | 20001 | 110 | 100 | -33 | ||||
6 | 100 | 20002 | 150 | 100 | 20002 | 145 | 200 | 23 | ||||
7 | 100 | 20003 | 125 | 100 | 20003 | 128 | 300 | 0 | ||||
8 | 100 | 20004 | 150 | 100 | 20004 | 170 | ||||||
9 | 100 | 20005 | 175 | 100 | 20005 | 180 | ||||||
10 | 200 | 20001 | 100 | 200 | 20001 | 102 | ||||||
11 | 200 | 20002 | 150 | 200 | 20002 | 140 | ||||||
12 | 200 | 20003 | 125 | 200 | 20003 | 120 | ||||||
13 | 200 | 20004 | 150 | 200 | 20004 | 140 | ||||||
14 | 200 | 20005 | 175 | 200 | 20005 | 175 | ||||||
15 | 300 | 20001 | 100 | 300 | 20001 | 100 | ||||||
16 | 300 | 20002 | 150 | 300 | 20002 | 150 | ||||||
17 | 300 | 20003 | 125 | 300 | 20003 | 125 | ||||||
18 | 300 | 20004 | 150 | 300 | 20004 | 150 | ||||||
19 | 300 | 20005 | 175 | 300 | 20005 | 175 | ||||||
Sheet8 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
J5:J7 | J5 | =SUMPRODUCT((($A$5:$A$19=I5)*($C$5:$C$19))-(($E$5:$E$19=I5)*($G$5:$G$19))) |