Sum a Filtered Column

Hi All, I am trying to write a DAX that will sum a column based on the product name of another column, and am getting the syntax incorrect.

Am trying to calculate:

Variable = Total Product B = Sum (Table 1 [column 1)) , filter Table 1[column 2] “Product B”.
Return

Divide (Total Product B, Sum (Table 1 [Column 1))

Somewhere I’m not writing the syntax or calculation order correctly. Just wondering if someone could assist. Thanks.

Hello @Dplex,

Thank You for posting your query onto the Forum.

Try something like this -

Measure =
VAR _Total_Product_B = 
CALCULATE( SUM( Table_1[column_1] ) , 
	Table_1[column_2] = "Product B" )

RETURN
DIVIDE( 
    _Total_Product_B , 
    SUM( Table_1[Column_1 ) )

Hoping you find this useful and meets your requirements.

Thanks and Warm Regards,
Harsh

1 Like

Harsh, brilliant mate. Thanks very much.