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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Sage2019
Frequent Visitor

Ranking top 4 including selected item in the same category

Hi 
I would like to visualize the top 4 including the one selected item from the same group or category. 

For example, the top 4 countries and their population including the country that is selected in the slicer. this compares the other 4 countries with the highest population with the selected country in the same region. 
While I can get the top 4 and rank it, I am not sure how I can get the selected country in it as well.

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @Sage2019 ,

first create a un-connect table for the slicer:

vcgaomsft_1-1709275831733.png

and then please create a new measure for the visual's filter:

Filter = 
VAR __ranking = RANKX(ALLSELECTED('Table'[Country]),[Total Population])
VAR _select_value = ALLSELECTED('DimCountry'[Country])
VAR _result = IF(__ranking<=4 || SELECTEDVALUE('Table'[Country]) IN _select_value,1)
RETURN
_result

vcgaomsft_2-1709275921998.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Daniel29195
Super User
Super User

Hello @Sage2019 

 

can you please share a sample data and the output of what you want to achieve ? 

 

best regards,

@Daniel29195 , @v-cgao-msft 

CountryRegionPopulation
ANorth500,000
BNorth460000
CNorth80000
DWest240000
FWest390249
GEast94239
HWest139403
IEast293131
JNorth60000

 

my country slicer is a field in the Dim Country Table that is connected to my Population table. 

The results I want to achieve is if I single select J as the country I should see J in the visual along with the top 3 or 4 countries in the same region North. Therefore the visual should have A,B and J if it's the top 3 or A,B,C and J if top 4

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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