Forum Discussion
Need help in dax
Hello there,
I am looking for help in Dax, I need to perform aggregation(sum) based on the product with an explicit filter condition.
Sample Data:
| Product | Value | Trendy |
| Apple | 2000 | Yes |
| Apple | 3000 | No |
| Orange | 1000 | Yes |
| Orange | 2000 | No |
| Mango | 1000 | Yes |
| Mango | 1000 | No |
eg: for apple , I should sum where trendy="Yes",
for orange, I should show sum where trendy="No",
else just sum
Expected Result:
| Product | Sales |
| Apple | 2000 |
| Orange | 2000 |
| Mango | 2000 |
I have tried something like this but not getting the expected result.
Anonymous , Try like
Measure = sumx(Sheet1,SWITCH(TRUE(),Sheet1[Product]="Apple" && Sheet1[Trendy]="Yes", Sheet1[Value],
Sheet1[Product]="Orange" && Sheet1[Trendy]="No",Sheet1[Value],
Sheet1[Product] in {"Orange","Apple"} , blank(),
Sheet1[Value])
)
1 Reply
- amitchandak
Super User
Anonymous , Try like
Measure = sumx(Sheet1,SWITCH(TRUE(),Sheet1[Product]="Apple" && Sheet1[Trendy]="Yes", Sheet1[Value],
Sheet1[Product]="Orange" && Sheet1[Trendy]="No",Sheet1[Value],
Sheet1[Product] in {"Orange","Apple"} , blank(),
Sheet1[Value])
)