Forum Discussion
DAX HELP
- 6 years ago
shebr wrote:Hi Anonymous
Can you try this as a measure? Let me know how you get on? Are you expecting 1700 as your value?
My Calc =var one = CALCULATE(SUM(SO_BI_FACT[QTY]),FILTER(SO_BI_FACT,SO_BI_FACT[CLASSIFICATION] <> "C&I"&& SO_BI_FACT[FLAG]=1 ))VAR two = CALCULATE(SUM(SO_BI_FACT[QTY2]),FILTER(SO_BI_FACT,SO_BI_FACT[CLASSIFICATION] = "C&I"))return CALCULATE(one + two, ALL(SO_BI_FACT))Anonymous did you try this measure?
| SO ID | CUSTOMER | CLASSIFICATION | FLAG | QTY | QTY2 |
| 1 | C1 | C&I | 0 | 100 | |
| 2 | C2 | EBO | 1 | 200 | |
| 3 | C2 | EBO | 1 | 100 | |
| 4 | C2 | EBO | 0 | 400 | |
| 5 | C1 | C&I | 1 | 500 | |
| 6 | C1 | C&I | 0 | 800 | |
| EXPECTED RESULT | |||||
| CUSTOMER | FINAL QTY | ||||
| C1 | 1400 | ||||
| C2 | 300 |
This formula is adding fourth SO ID also, where flag is not equal to 1.
This is the issue am facing.
Hi Anonymous
I have the exact expected result as you have stated. Same values.
I dont understand what further you need? Can you clarify what the measure is intended to do? At the moment, from what you have posted, you want to add the following
1) The SUM of QTY where CLASSIFICATION <> "C&I" AND FLAG = 1. With your data this is total of 300, correct?
you want to add this value to the following:
2) The SUM of QTY 2 where CLASSIFICATION = "C&I". With your data this is 1400.
Together this is 1700. As per your data.
What is the issue here?
Thanks
Shebr