- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Top 1 to 5 in separate columns
Hi,
Sorry but I was trying this out but I can't seem to find a way. Is it possible to create a column each for Top 1, Top 2, ... Top 5?
Thank you for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Teena_Pa4
Assume your dataset is like this
In Queries Editor
1. Split column on “ category”
2. Fill down
3. Add custom column
4. Merge column
5. Rename column “Merged”->”category”
Remove columns category.1, category.2, Custom.
Close &&Apply
go back to Data view
create a calculated column
rank = RANKX(FILTER(ALL(Sheet1),[category]=EARLIER(Sheet1[category])),[count of people],,DESC)
then add columns in a Matrix visual
Best Regards
Maggie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Most likely, yes.
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you greg.
I need to get the Top 1 to 5 cities per category and then under each city, I need to show the total amount. Hope the data below helps:
My data:
category city count of people amount Rank
cat1 a 10 1000 1
b 5 500 3
c 8 100 2
d 3 700 5
e 1 400 6
f 4 500 4
cat2 a 7 1000 1
b 5 1500 2
c 2 700 3
cat3 a 3 400 4
b 8 200 2
c 5 100 3
d 2 300 5
e 9 600 1
Expected result:
Top 1 Top 2 Top 3 Top 4 Top 5
category 1 1000 100 500 500 700
category 2 1000 1500 700
category 3 600 200 100 400 300
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I accidentally posted the unfinished message.
But here's my data. The ranking will be based on the cities with the highest number of people count. I need to get the Top 1 to 5 cities per category and then under each city, I need to show the total amount. Hope the data below helps:
category; city; count of people; amount; Rank
cat1 a 10 1000 1
b 5 500 3
c 8 100 2
d 3 700 5
e 1 400 6
f 4 500 4
cat2 a 7 1000 1
b 5 1500 2
c 2 700 3
cat3 a 3 400 4
b 8 200 2
c 5 100 3
d 2 300 5
e 9 600 1
Expected result:
Top 1 Top 2 Top 3 Top 4 Top 5
category 1 1000 100 500 500 700
category 2 1000 1500 700
category 3 600 200 100 400 300
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Teena_Pa4
Assume your dataset is like this
In Queries Editor
1. Split column on “ category”
2. Fill down
3. Add custom column
4. Merge column
5. Rename column “Merged”->”category”
Remove columns category.1, category.2, Custom.
Close &&Apply
go back to Data view
create a calculated column
rank = RANKX(FILTER(ALL(Sheet1),[category]=EARLIER(Sheet1[category])),[count of people],,DESC)
then add columns in a Matrix visual
Best Regards
Maggie

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-18-2024 01:04 PM | |||
07-27-2024 05:45 AM | |||
10-04-2022 01:17 AM | |||
Anonymous
| 03-13-2024 02:29 AM | ||
07-24-2022 11:09 AM |
User | Count |
---|---|
83 | |
81 | |
52 | |
37 | |
36 |
User | Count |
---|---|
104 | |
85 | |
47 | |
43 | |
42 |