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?
Hi Anonymous
Can you try this as a measure? Let me know how you get on? Are you expecting 1700 as your value?
| SO ID | CUSTOMER | CLASSIFICATION | FLAG | QTY | QTY2 |
| 1 | C1 | C&I | 0 | 100 | |
| 2 | C2 | EBO | 1 | 200 | |
| 3 | C2 | EBO | 1 | 100 | |
| 4 | C1 | C&I | 1 | 500 | |
| 5 | C1 | C&I | 0 | 800 | |
| RESULT | |||||
| CUSTOMER | FINAL QTY | ||||
| C1 | 1400 | ||||
| C2 | 300 |
- shebr6 years ago
Resolver III
Yep, this is the expected result with my last message:
- Anonymous6 years agoNot applicable
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.
- shebr6 years ago
Resolver III
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