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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Suhel_Ansari
Helper IV
Helper IV

Category and Subcategory TOP 5 Rank without Tie Break

keep only the inHi All,

I have the Report where I Need the Top 5 Veh_Models and Top 1 Veh_Details in a table I have tired TOPN for Veh_Models within the Visuals and cretaed a Measure [Top 1 Veh_Details] as follows, It's working fine whowhen i try to filter via country slicer we have a ties it's shown me the Top all the Veh_Details rows with ties however I need to keep only the Top 1.

Please asssit me how can I get only the Top 1 Record for the Veh_Details . Thanks

 

Counts = CALCULATE( COUNTROWS('Dataset'))

 

Top 1 Veh_Details =
VAR Rank5 = RANKX( ALLSELECTED('Dataset'[Vehicle_Detailed_Model]) , [Counts],,DESC,Skip)
VAR Result = IF( Rank5 = 1 , 1 )
RETURN
Result

 

Suhel_Ansari_0-1700739985417.png

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Suhel_Ansari ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1701065910487.png

(2) We can create a measure. 

Top 1 Veh_Details = 
VAR Rank5 = RANKX(ALLSELECTED('Dataset'),[Counts],,DESC,Skip)
VAR Result = IF( Rank5 = 1 , 1,BLANK() )
RETURN
IF(Result=1,MAX('Dataset'[detail]),BLANK())

(3) Then the result is as follows.

vtangjiemsft_1-1701066298995.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @Suhel_Ansari ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1701065910487.png

(2) We can create a measure. 

Top 1 Veh_Details = 
VAR Rank5 = RANKX(ALLSELECTED('Dataset'),[Counts],,DESC,Skip)
VAR Result = IF( Rank5 = 1 , 1,BLANK() )
RETURN
IF(Result=1,MAX('Dataset'[detail]),BLANK())

(3) Then the result is as follows.

vtangjiemsft_1-1701066298995.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Suhel_Ansari
Helper IV
Helper IV

@amitchandak 

@Greg_Deckler 

@ChandeepChhabra 

 

Please assist 🙏

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.