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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ROG
Responsive Resident
Responsive Resident

bottom 5 dax not working

Hello Community,

 

The dax below supposed to give me the bottom 5 carriers + the remaining (Others). Bottom is this case means negative No of Port-Outs, so I was able to get the Top5, and added the 'DESC' funcion to give the negative values. But the result is showing only the 'Others' and I'm missing the Bottom 5 Carriers. Can you help, please? How to have a dax that can show me the bottom 5 + the remaing?

 

TopN No Port-Outs =

VAR TopN_Table =
TOPN(
    5,
    ALLSELECTED(CarrierList),
    [No Port-Outs],DESC
)

VAR TopN_KeepFilters_NoPortOuts =
CALCULATE(
    [No Port-Outs],
    KEEPFILTERS(TopN_Table)
)

VAR Total_NoPortOuts =
CALCULATE(
    [No Port-Outs],
    ALLSELECTED(CarrierList)
)

VAR TopN_NoPortOuts =
CALCULATE(
    [No Port-Outs]
    ,TopN_Table
)

VAR Others_NetPorts = Total_NoPortOuts - TopN_NoPortOuts

VAR Others_isSelected = SELECTEDVALUE(CarrierList[carrier]) = "Others"

RETURN
IF (ISINSCOPE(CarrierList[carrier]), IF(Others_isSelected, Others_NetPorts, TopN_KeepFilters_NoPortOuts), Total_NoPortOuts)
 
Expected result
ROG_0-1703688703853.png

 

Real - wrong result

 ROG_1-1703688730457.png

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ROG ,

 

Based on the information you have provided, you can follow these steps:

1.Add new column

 

ranking =

RANKX ( ALL ( 'Table' ), 'Table'[No Port-Outs],, DESC, DENSE )

 

2.Add new column

 

new carrier =

IF ( 'Table'[ranking] <= 5, 'Table'[carrier], "Others" )

 

 

3.Put in Matrix

Final output:

vyifanwmsft_0-1703733116909.png

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

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
Anonymous
Not applicable

Hi @ROG ,

 

Based on the information you have provided, you can follow these steps:

1.Add new column

 

ranking =

RANKX ( ALL ( 'Table' ), 'Table'[No Port-Outs],, DESC, DENSE )

 

2.Add new column

 

new carrier =

IF ( 'Table'[ranking] <= 5, 'Table'[carrier], "Others" )

 

 

3.Put in Matrix

Final output:

vyifanwmsft_0-1703733116909.png

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

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

ROG
Responsive Resident
Responsive Resident

That works! Many thanks @Anonymous 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors