March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
i have write a simple dax of subtraction and division and I have a region as drilldown
my requirement says to remove the relationship between dim country table and fact table so I removed it using CROSSFILTER
since I remove the relationship my values for individual region is not right, all region inside a month year shows same value
ex. if month year nov 24 total is 200
nov 24 asia is 100
nov 24 europe is 25
nov 24 NA is 50
nov 24 LA is 25
after removing the relationship using CROSSFILTER
in drilldown for all region ( asia, europe, NA and LA ), I get 200
my requirement is to remove country region relationship at the same time the overall dax logic should work on drilldown
Requirement:
left side visual is what by default we get in PBI
what I need is right side visual but the values of all region should not be 0.31 rather
apac - 1
europe - 0.5
la - 0.5
afracia - 1
australia - 1
na - 1
uae - 0
only apac, europe and la have both numerator and denominator so it should give respective values
uae only has denominator so it is 0 (0/anything)
rest regions doesn't have data so it should give value as 1
-----------------------------------------------------------------------------------------------------------------------
dax:
s rate
mk | region | inclusion flag | success |
1 | apac | y | 95 |
1 | europe | n | 85 |
1 | la | y | 91 |
1 | na | n | 97 |
1 | africa | n | 88 |
1 | australia | n | 95 |
1 | apac | y | 93 |
2 | europe | y | 94 |
2 | la | n | 89 |
2 | na | n | 88 |
2 | africa | n | 99 |
2 | australia | n | 80 |
2 | uae | n | 90 |
region
region |
apac |
europe |
la |
na |
africa |
australia |
uae |
month
mk | m |
1 | nov |
2 | dec |
Hi @animebuff ,Thank you for reaching out to Microsoft Fabric Community Forum.
If the direct relationship between the dimCountry table and the fact table is removed, it will impact the filtering context, so now you see the same total for all regions.
We can use the TREATAS function to create a virtual relationship between the dimCountry table and the fact table. This way, we can eliminate the physical relationship while keeping the correct context for the calculations.
Sample Data:
dimCountry Table
fact Table
Total Value Measure:
Total Value =
VAR SelectedCountries = VALUES(dimCountry[Country])
RETURN
CALCULATE (
SUM(fact[Value]),
TREATAS(SelectedCountries, fact[Country])
)
Set up a Matrix Visual:
Sample Output:
If this helps, please mark it ‘Accept as Solution’, so others with similar queries may find it more easily. If not, please share the details.
Requirement:
left side visual is what by default we get in PBI
what I need is right side visual but the values of all region should not be 0.31 rather
apac - 1
europe - 0.5
la - 0.5
afracia - 1
australia - 1
na - 1
uae - 0
only apac, europe and la have both numerator and denominator so it should give respective values
uae only has denominator so it is 0 (0/anything)
rest regions doesn't have data so it should give value as 1
-----------------------------------------------------------------------------------------------------------------------
dax:
s rate
mk | region | inclusion flag | success |
1 | apac | y | 95 |
1 | europe | n | 85 |
1 | la | y | 91 |
1 | na | n | 97 |
1 | africa | n | 88 |
1 | australia | n | 95 |
1 | apac | y | 93 |
2 | europe | y | 94 |
2 | la | n | 89 |
2 | na | n | 88 |
2 | africa | n | 99 |
2 | australia | n | 80 |
2 | uae | n | 90 |
region
region |
apac |
europe |
la |
na |
africa |
australia |
uae |
month
mk | m |
1 | nov |
2 | dec |
Updated DAX Measure
Measure =
VAR CurrentRegionFilter =
VALUES(DimCountry[Region])
RETURN
CALCULATE(
SUM(FactTable[Sales]),
TREATAS(CurrentRegionFilter, FactTable[Region])
)
💌 If this helped, a Kudos 👍 or Solution mark ✅ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
more clear version of my requirement
requirement:
left side visual is what by default we get in PBI
what I need is right side visual but the values of all region should not be 0.31 rather
apac - 1
europe - 0.5
la - 0.5
afracia - 1
australia - 1
na - 1
uae - 0
only apac, europe and la have both numerator and denominator so it should give respective values
uae only has denominator so it is 0 (0/anything)
rest regions doesn't have data so it should give value as 1
-----------------------------------------------------------------------------------------------------------------------
dax:
mk | region | inclusion flag | success |
1 | apac | y | 95 |
1 | europe | n | 85 |
1 | la | y | 91 |
1 | na | n | 97 |
1 | africa | n | 88 |
1 | australia | n | 95 |
1 | apac | y | 93 |
2 | europe | y | 94 |
2 | la | n | 89 |
2 | na | n | 88 |
2 | africa | n | 99 |
2 | australia | n | 80 |
2 | uae | n | 90 |
region
region |
apac |
europe |
la |
na |
africa |
australia |
uae |
month
mk | m |
1 | nov |
2 | dec |
Hi @animebuff
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
so left side visual is what by default we get in PBI
what I need is right side visual but the values of all region should not be 0.31 rather
apac - 1
europe - 0.5
la - 0.5
afracia - 1
australia - 1
na - 1
uae - 0
only apac, europe and la have both numerator and denominator so it should give respective values
uae only has denominator so it is 0 (0/anything)
rest regions doesn't have data so it should give value as 1
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |