cancel
Showing results for
Did you mean:
Helper II

## Calculate a measure with custom conditions

Hi there,

I need to calculate a measure wherein if condition 1 is met and condition 2 is met then do the sum.

e.g. calculate sum revenue if siteid ="1234" and Item no <> ("A234","B345","M3456")

Many thanks,

1 ACCEPTED SOLUTION
Super User II

Put the conditions in a set of () the seperate them with || which is OR.

``````Revenue Meausure =
CALCULATE (
SUM ( YourTable[Revenue] ),
( YourTable[siteid] = "1234" && NOT YourTable[Item No] IN { "A234", "B345", "M3456" } )
||
( YourTable[siteid] = "2345" && NOT YourTable[Item No] IN { "B345", "M3456" } )
)
``````
4 REPLIES 4
Super User II

Put the conditions in a set of () the seperate them with || which is OR.

``````Revenue Meausure =
CALCULATE (
SUM ( YourTable[Revenue] ),
( YourTable[siteid] = "1234" && NOT YourTable[Item No] IN { "A234", "B345", "M3456" } )
||
( YourTable[siteid] = "2345" && NOT YourTable[Item No] IN { "B345", "M3456" } )
)
``````
Super User II

Try it like this.

``````Revenue Meausure =
CALCULATE (
SUM ( YourTable[Revenue] ),
YourTable[siteid] = "1234"
&& NOT YourTable[Item No] IN { "A234", "B345", "M3456" }
)
``````
Helper II

Thanks @jdbuchanan71

I will also need the same with multiple siteid.

e.g. if siteid ="1234" and Item no <> ("A234","B345","M3456") then sum revenue

if  siteid ="2345" and Item no <> ("B345","M3456") then sum revenue

and so on

Helper II

@jdbuchanan71 need the above in one measure

Announcements

#### Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

#### Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors