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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Creating Buckets based on Top N Numbers

Hi, I am trying to find out a solution for showing Top Numbers as in bucket format. Ex:- I have a column (Messages). I need to find out Top 5 messages , top 5 to 10 messages , top 10 to 15 messages.I need to create it from buckets as in my drop down says as Top Messages Top 5, Top 5 to 10, Top 10 to 15. As per my drop down selections i need my table chart to display the messages accordingly. Please suggest. 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ranking = 
Var YourRank = RANKX(
    FILTER(Tble,
            Tble[Class]=EARLIER(Tble[Class])
    )
    ,Tble[Sl.No],,ASC
)
Return
SWITCH(
        TRUE(),
        YourRank<=5,"Top 5",
        YourRank>5 && YourRank<=10,"Top 5-10",
        YourRank>10 && YourRank<=15,"Top 10-15",
        "More than 15"
)

View solution in original post

6 REPLIES 6
AlB
Community Champion
Community Champion

Hi @Anonymous 

Here's an idea. Create a calculated column:

Bucket =
VAR Rank_ =
    RANKX ( Table1, Table1[Column to rank on],, DESC )
RETURN
    SWITCH (
        TRUE (),
        Rank_ <= 5, "Top 5",
        Rank_ <= 10, "Top 5-10",
        Rank_ <= 15, "Top 10-15",
        BLANK ()
    )

You can then use that column to slice your data

 

 

Anonymous
Not applicable

Thank you for your response, What exactly I am looking for is :

Consider I have a table as below

Sl.NoClassmessage
1aabc
2bxyz
3cww
4brr
5sed
6asgg
7rthg
8asc
9bswa
10chjy
11cfs
12asse
13aew
14ctr
15but

 

I need two drop downs 1.Class   2.TopN as (0 to5, 6to10,11 to15).

When i choose Class a in first drop down and select 0to5 bracket in second drop down, my table has to show me only top 5 recordes of Class A.

Hope i made it clear.

please suggest

Anonymous
Not applicable

Here the top 5 need to be decided by which cloumn, is there any seperate fact(like sales) for the same or top from the first column serial number?

Anonymous
Not applicable

From the above table, I need Top0to5 messages of class A.

Table should show me the messages recordes as per my selection on drop downs.

 

If I select Top "0t05" in 1st drop down and select "a" in class dropdown. table should give me top5 of class a records.if i select "6to10" in 1st drop down and select a or "b" in class dropdown. table should give me top 6to10 of class a or b records as per drop down selection.

 

what column should we consider to create buckets drop down as (0to5,6to10,11to15 & 16to20).

 

Anonymous
Not applicable

Create a new calcuated column in the table with below DAX.

Use this column as filter along with the filter for class.

 

 

Capture.PNG

Anonymous
Not applicable

Ranking = 
Var YourRank = RANKX(
    FILTER(Tble,
            Tble[Class]=EARLIER(Tble[Class])
    )
    ,Tble[Sl.No],,ASC
)
Return
SWITCH(
        TRUE(),
        YourRank<=5,"Top 5",
        YourRank>5 && YourRank<=10,"Top 5-10",
        YourRank>10 && YourRank<=15,"Top 10-15",
        "More than 15"
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.