Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have the following tables and relationships:
I have a matrix visual showing:
If I try to add the "Ship-To State" field from either fact table to this visual, it shows all "Ship-To-States" since the fact tables aren't directly related.
How can I use DAX to create a measure that shows the Country and State from the applicable fact_orders table records on the rows?
To illustrate, the point of the matrix on the right is to combine the two on the left.
You'll see that the totals are correct.
I'm just trying to figure out how I can avoid the cartesian product where every ship-to-state from each of the two fact tables is shown rather than just those that are involved in the totals.
In this example, the "total bottles" measure is calculated as follows
=
CALCULATE(
DISTINCTCOUNT('fact_orders_a'[Order No.])
,'fact_orders_a'[Customer Type]="Wholesale"
,'fact_orders_a'[Is Refunded Order]=FALSE())
-
CALCULATE(
DISTINCTCOUNT('fact_orders_a'[Order No.])
,'fact_orders_a'[Customer Type]="Wholesale"
,'fact_orders_a'[Is Refunded Order]=TRUE())
+
CALCULATE(
DISTINCTCOUNT('fact_orders_b'[order_no])
)
Hi @Jihwan_Kim. I understand SWITCH function, and it may come into play here later. Thank you for your suggestion.
However, the main issue with my model is that, since the two order tables are not directly related, attempting to show a ship-to-state in the rows section of the matrix works for rows where the values are from that table, but for rows where the values are from the other table, it shows all ship-to-states.
Hi,
I am not sure how your semantic model looks like, but one of ways to achieve this is to use SWITCH DAX function in the measure with your business rules when to use which fact table.
SWITCH function (DAX) - DAX | Microsoft Learn
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |