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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.