Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
chavanr
Resolver I
Resolver I

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
Super User

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
Super User

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

@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_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.