Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
Solved! Go to Solution.
@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])
)
@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])
)
User | Count |
---|---|
102 | |
91 | |
87 | |
79 | |
71 |
User | Count |
---|---|
113 | |
105 | |
101 | |
75 | |
64 |