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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
animebuff
Helper I
Helper I

dax relationship issue in drilldown

requirement:

animebuff_0-1734610567977.png

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:

 

default dax = CALCULATE(COUNT('S rate'[success]),'S rate'[inclusion flag]="Y")/COUNT('S rate'[success])
 
modified dax = CALCULATE(CALCULATE(COUNT('S rate'[success]),'S rate'[inclusion flag]="Y")/COUNT('S rate'[success]),CROSSFILTER(region[region],'S rate'[region],None))
 
-----------------------------------------------------------------------------------------------------------------------
 
tables:
 
s rate 
mkregioninclusion flagsuccess
1apacy95
1europen85
1lay91
1nan97
1african88
1australian95
1apacy93
2europey94
2lan89
2nan88
2african99
2australian80
2uaen90

 

region

region
apac
europe
la
na
africa
australia
uae

 

month

mkm
1nov
2dec
2 REPLIES 2
v-linhuizh-msft
Community Support
Community Support

Hi @animebuff ,

 

Please try the following DAX formula, the RELATEDTABLE function can be used to ensure that the measure is calculated correctly in the region table:

New dax = 
VAR _count_flag=IF(CALCULATE(COUNTROWS(RELATEDTABLE('s rate')),'s rate'[inclusion flag]="y")<>0,CALCULATE(COUNTROWS(RELATEDTABLE('s rate')),'s rate'[inclusion flag]="y"),0)
VAR _y_region_count = COUNTROWS(RELATEDTABLE('s rate'))
RETURN 
DIVIDE(_count_flag,_y_region_count)

 

Result:

vlinhuizhmsft_1-1734659367428.png

 

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

@v-linhuizh-msft thanks for the reply,

 

still it didn't met the requirement, I gave count as example but I need is distinct count and the other issue is africa, australia and na should show 1 since both numerator and denominator is not available for these countries and only uae should show 0 since numerator is 0 for uae 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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