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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have these facts and dimensions:
factOrders
dimAddress1
dimAddress2
These are the relationships:
dimAddress1 -> factOrders
dimAddress2 -> factOrders
I am trying to create a measure that does this:
Number of Orders with Overseas Addresses :=
DISTINCTCOUNT of factOrders.OrderID
WHERE (dimAddress1.IsOverseas = "Y" OR dimAddress2.IsOverseas = "Y")
Here is my attempt at the DAX:
CALCULATE(
DISTINCTCOUNT('factOrders'[OrderID]),
'dimAddress1'[Is Overseas] = "Y" || 'dimAddress2'[Is Overseas] = "Y"
)
but it gives the error "The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression."
Any suggestions?
// This formula uses this math formula for sets:
// |A + B| = |A| + |B| - |A * B|
// Since the formula does not use OR, it
// might be faster... but can't guarantee it.
# Overeas Orders :=
var __ordersWithOverseasAddr1 =
calculate(
distinctcount( factOrders[OrderId] ),
keepfilters( dimAddress1.IsOverseas = "Y" )
)
var __ordersWithAverseasAddr2 =
calculate(
distinctcount( factOrders[OrderId] ),
keepfilters( dimAddress2.IsOverseas = "Y" )
)
var __ordersWithBothAddrOverseas =
calculate(
distinctcount( factOrders[OrderId] ),
keepfilters( dimAddress2.IsOverseas = "Y" ),
keepfilters( dimAddress1.IsOverseas = "Y" )
)
return
__ordersWithOverseasAddr1
+ __ordersWithOverseasAddr2
- __ordersWithBothAddrOverseas
It might not be the simplest but it might be fast and it's easily understandable (if you know math, that is).
Best
D
This seems to be working:
COUNTROWS(
FILTER(
SUMMARIZE(
'factOrders',
'factOrders'[OrderID],
"IsOverseasOrder",
MAX
(
MAXX('dimAddress1', IF('dimAddress1'[Is Overseas] = "Y", 1, 0)),
MAXX('dimAddress2', IF('dimAddress2'[Is Overseas] = "Y", 1, 0))
)
),
[IsOverseasOrder] = 1
)
)But it seems far too complicated. Is there a simpler way to do this?
Perhaps:
COUNTROWS(
FILTER(
SUMMARIZE(
'factOrders',
'factOrders'[OrderID],
"IsOverseasOrder",
IF(
'dimAddress1'[Is Overseas] = "Y" ||
'dimAddress2'[Is Overseas] = "Y",
1, 0
)
)
),
[IsOverseasOrder] = 1
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 8 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 29 | |
| 19 | |
| 18 | |
| 11 | |
| 10 |