Bail P
Bail P

Reputation: 281

SUM if value or another value

I am trying to create a simple measure that sums the total of a column if multiple conditions are true. This is the table:

enter image description here

I want to sum the value in the 'value' column if it is type 'A' or type 'B'.

How would I go about doing this?

Upvotes: 0

Views: 34

Answers (1)

Joao Leal
Joao Leal

Reputation: 5542

You create a measure like this:

total= CALCULATE(SUM(table[Value]), table[Type] IN {"A","B"})

If you want it to react to a filter on type you can change it to:

total= CALCULATE(SUM(table[Value]), KEEPFILTERS(table[Type] IN {"A","B"}))

Upvotes: 2

Related Questions