Forum Discussion
alihijazi
Helper I
10 years agohelp in measure
Hello I'm new to Power BI
I want to create a measure that calculates the sum(qty*price) where product_type = 'X' or Product_type='Y'
Please advise
Hello,
Try this measure
SUMX(Table, IF(OR(Table[Product_Type]="X", Table[Product_Type]="Y"), Table[Qty]*Table[Price], ""))But I believe there's an easier way if someone else can help.
2 Replies
- SabineOussi
Skilled Sharer
Hello,
Try this measure
SUMX(Table, IF(OR(Table[Product_Type]="X", Table[Product_Type]="Y"), Table[Qty]*Table[Price], ""))But I believe there's an easier way if someone else can help.
- v-sihou-msft
Microsoft Employee
Hi alihijazi,
You can apply the filters within SUMX() function. The expression can be like:
=SUMX(FILTER(table,OR(table[product_type]="X",table[product_type]="Y")),table[qty]*table[price])
Reference:SUMX Function (DAX)
Regards,