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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Hong_HW
Frequent Visitor

Need help on Dax_Return a specified value if all options are selected in the filter

Hi, 

Really appreciate it if you could help me on the dax to return the following result.

 

I want the return result to show the Ctry value of 74% if all countries are selected in the country filter.

 

 

Country Filter
SG
CN
KR
UK
IN
IN
MY
TH

 

 

Data Table
Countryshare%
SG78%
CN75%
KR89%
UK67%
IN70%
Ctry74%

 

Hong_HW_0-1716311100526.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Hong_HW 

 

Thanks for the reply from @Jihwan_Kim , please allow me to provide another insight:

 

@Hong_HW , the following methods are for your reference.

 

Create a measure as follow

Measure = 
VAR _ctry = CALCULATE(SUM('Data Table'[share%]), FILTER('Data Table', [Country] = "Ctry"))
VAR _share = CALCULATE(SUM('Data Table'[share%]), FILTER('Data Table', [Country] = SELECTEDVALUE(Country[Country])))
RETURN
IF(NOT(ISFILTERED(Country[Country])), _ctry, _share)

 

Output:

vxuxinyimsft_0-1716344260911.png

In the above formula, if you select a country, it returns the "share%" of the corresponding country, you can modify it according to your needs.

 

Best Regards,
Yulia Xu

 

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Hong_HW 

 

Thanks for the reply from @Jihwan_Kim , please allow me to provide another insight:

 

@Hong_HW , the following methods are for your reference.

 

Create a measure as follow

Measure = 
VAR _ctry = CALCULATE(SUM('Data Table'[share%]), FILTER('Data Table', [Country] = "Ctry"))
VAR _share = CALCULATE(SUM('Data Table'[share%]), FILTER('Data Table', [Country] = SELECTEDVALUE(Country[Country])))
RETURN
IF(NOT(ISFILTERED(Country[Country])), _ctry, _share)

 

Output:

vxuxinyimsft_0-1716344260911.png

In the above formula, if you select a country, it returns the "share%" of the corresponding country, you can modify it according to your needs.

 

Best Regards,
Yulia Xu

 

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

Thank you very much for the clear explanation.

It works for me, really appreciate it.

Jihwan_Kim
Super User
Super User

Hi,

I assume the implicit measure is used in the visualizations.

Please try create a measure (explicit measure) by using AVERAGE DAX function.

Please refer to the link down below.

 

Tutorial: Create your own measures in Power BI Desktop - Power BI | Microsoft Learn

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi, 

Thank you for the reply.

But the average measure will not give me the correct result.

Ctry 74% is not the average of all countries.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Kudoed Authors