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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
dkernen
Resolver II
Resolver II

Calculate a metric with OR logic from two different tables

Hello.  I believe I have a relatively simple ask but one that I cannot figure out.

 

I have included a link to a sample dataset.  https://mwtn-my.sharepoint.com/:u:/g/personal/dkernen_mwtn_org/EZt6qdxeDXhJpZjw3Jaay4wBe5-VaTaxIwgjy...

 

I have three tables: dimension for SHAPES, dimension for COLORS, and a fact for SALES.  I know how to make measures for when color="Red" or when shape = "Round"  or when color=Red AND shape="Round" but I need to create a measure for when color="Red" OR shape="Round"

 

Any help would be most appreciated!  Thank you so much!

@CALCULATE, @ORlogic

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @dkernen - have you tried adding the separate results of "where color = red" and "where shape = round" ?  This would double-count those that are red and round, so you could then subtract "where color = red AND where shape = round".

 

RedOrRound = 
var __Red = CALCULATE([Total Sales], Colors[Color] = "Red")
var __Round = CALCULATE([Total Sales], Shapes[Shape] = "Round")
var __RandR = CALCULATE([Total Sales], Colors[Color] = "Red", Shapes[Shape] = "Round")
return
     (__Red + __Round) - __RandR

 

Hope this helps

David

View solution in original post

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

Hi @dkernen - have you tried adding the separate results of "where color = red" and "where shape = round" ?  This would double-count those that are red and round, so you could then subtract "where color = red AND where shape = round".

 

RedOrRound = 
var __Red = CALCULATE([Total Sales], Colors[Color] = "Red")
var __Round = CALCULATE([Total Sales], Shapes[Shape] = "Round")
var __RandR = CALCULATE([Total Sales], Colors[Color] = "Red", Shapes[Shape] = "Round")
return
     (__Red + __Round) - __RandR

 

Hope this helps

David

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.