The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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])
)