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

Create a TopN Slicer using a Data Field


Hi,

 

I'm trying to create a TopN slicer where the user can define how many instances to display. I found an earlier thread posted on this forum but that thread is referring to another measure for the sum portion of the problem. I'd like to refer to a data field already included in the data table I'm bringing into Power BI:

 

Link to old thread: https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

 

Created Measure from old thread:

TopN City =
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [Sales Amount],
RANKX (
ALLSELECTED( 'Orders'[City] ),
[Sales Amount]
)
<= SelectedTop,
[Sales Amount]
)

 

In the measure above, [Sales Amount] is a created measure. In place of it, I would like to refer to a specific data field 'Claim Data Pull'[Paid].

 

My question is, is that possible? Is there a way to manipulate the measure to sum 'Claim Data Pull'[Paid] in place of [Sales Amount]?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

As long as Claim Data it connected with City

TopN City =
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
RETURN
SWITCH(TRUE(),
SelectedTop = 0, calculate(sum('Claim Data Pull'[Paid])),
RANKX (
ALLSELECTED( 'Orders'[City] ),
calculate(sum('Claim Data Pull'[Paid]))
)
<= SelectedTop,
calculate(sum('Claim Data Pull'[Paid]))
)

 if you need more help make me @

Appreciate your Kudos.

 

 

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

As long as Claim Data it connected with City

TopN City =
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
RETURN
SWITCH(TRUE(),
SelectedTop = 0, calculate(sum('Claim Data Pull'[Paid])),
RANKX (
ALLSELECTED( 'Orders'[City] ),
calculate(sum('Claim Data Pull'[Paid]))
)
<= SelectedTop,
calculate(sum('Claim Data Pull'[Paid]))
)

 if you need more help make me @

Appreciate your Kudos.

 

 

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

Thank you so much.

 

Thank you,

Andrew

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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