Forum Discussion
chenko90
4 years agoFrequent Visitor
Summing on multiple rows
Hi, I am trying to create a measure that will sum my values based on two rows. My current formula is: SUMX(VALUES(Table[customer]),Table[Price Variance]) What i actually need is for the measure ...
- 4 years ago
chenko90 , This only need when Price Variance is measure
SUMX(summarize(Table, Table[Product], Table[customer]), "_1", Table[Price Variance]), [_1])
when price variance is a column
SUMX(summarize(Table, Table[Product], Table[customer], Table[Price Variance]), [Price Variance])
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Anonymous
4 years agoNot applicable
Hi chenko90 ,
I created some data:
Here are the steps you can follow:
Method one:
Create measure.
method one =
var _1=SUMMARIZE('Table','Table'[MAJOR_NAME],'Table'[SKU],'Table'[Price Vanriance])
return
SUMX(_1,[Price Vanriance])
Result:
Second method :
Create measure.
second method_1 =
IF(ISINSCOPE('Table'[MAJOR_NAME])&& NOT(ISINSCOPE('Table'[SKU])),SUMX('Table',[Price Vanriance]),MAX('Table'[Price Vanriance]))second method_2 =
var _table=SUMMARIZE('Table','Table'[MAJOR_NAME],"_value",[second method_1])
return
IF(HASONEVALUE('Table'[MAJOR_NAME]),[second method_1],SUMX( _table,[_value]))
Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly