cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chavanr
Helper II
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
jdbuchanan71
Super User II
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" } )
)

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User II
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" } )
)

View solution in original post

jdbuchanan71
Super User II
Super User II

@chavanr 

Try it like this.

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

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

 

@jdbuchanan71 need the above in one measure

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

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

MBAS on Demand

Microsoft Business Applications Summit sessions

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors