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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Top N

Hello All,

 

I want to show Top N(5) KPI based on variance whose fav_condition="2".  Can anyone tell me how to ahcieve this?

As I had passed the visual filter on fav_condition="2" and used then TOP 5 on KPI, its not showing properly.

I need to filter data by fav_condition="2" then need Top 5 kpi among that by variance 

 

Krutigawale33_0-1612448639234.png

 

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

Hi  @Anonymous ,

 

Create a measure as below:

Measure = 
var _rank=RANKX(FILTER(ALL('Table'),'Table'[Fav_condition2]=2),CALCULATE(MAX('Table'[Variance])),,DESC)
Return
IF(MAX('Table'[Fav_condition2])=2&&_rank<=5,MAX('Table'[Variance]),BLANK())

And you will see:

v-kelly-msft_0-1612766515382.png

For the related .pbix file,pls see attached.

 

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Create a measure as below:

Measure = 
var _rank=RANKX(FILTER(ALL('Table'),'Table'[Fav_condition2]=2),CALCULATE(MAX('Table'[Variance])),,DESC)
Return
IF(MAX('Table'[Fav_condition2])=2&&_rank<=5,MAX('Table'[Variance]),BLANK())

And you will see:

v-kelly-msft_0-1612766515382.png

For the related .pbix file,pls see attached.

 

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

amitchandak
Super User
Super User

@Anonymous , Try measures like

 

new var = calculate([variance], filter(Table, Table[fav_condition]="2"))

Top 1 Rank = CALCULATE([new var ],TOPN(1,all(Table[KPI]),[new var],DESC),VALUES(Table[KPI]))

 

replace 1 with N you want

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.