Forum Discussion
SUM function with multiple condition
- 3 years ago
Hi auron ,
Try the following code:
Total = SUMX ( SUMMARIZE ( FILTER ( 'Table', 'Table'[requested] = "TRUE" ), 'Table'[id], 'Table'[price] ), 'Table'[price] )Be aware that if you have different values for the price in each ID you get the value twice depending on the option you need you may need to adjust this to the following:
Total = SUMX ( SUMMARIZE ( FILTER ( 'Table', 'Table'[requested] = "TRUE" ), 'Table'[id], "MAXIMUMPRICE", MAX ( 'Table'[price] ) ), [MAXIMUMPRICE] )You can then adjust the MAX to minimum, average whatever value you need if the prices are different.
Hi , auron
According to your description, you want to ”SUM function with multiple condition“.
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can click "New Measure" to create a measure:
Measure =
var _t2= SUMMARIZE(FILTER('Table','Table'[requested]=TRUE()), [id] ,"price" , MAX([price]))
return
SUMX(_t2 ,[price])
Then we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly