Reply
Topic Options
- 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 n by dynamic
12-01-2023
11:56 PM
Dear experts,
I have a table with three fields: sales, customer, and qty .
p_TOPN = DATATABLE (
"index", INTEGER,
"TOPN", STRING,
{
{ 1,"TOP1" },
{ 2,"TOP2" },
{ 3,"TOP3" }
})
rank meature value
rank_by = SWITCH(TRUE(),
ISFILTERED(Sheet1[sales]),RANKX(ALL(Sheet1[sales]),[qtySum]),
ISFILTERED(Sheet1[customer]),RANKX(ALL(Sheet1[customer]),[qtySum]),
BLANK())
I am now able to rank sales and customer sales separately.
I hope to dynamically switch between res1 and res2 through field parameters p_muti
p_muti = {
("sales", NAMEOF('Sheet1'[sales]), 0),
("customer", NAMEOF('Sheet1'[customer]), 1)
}
TOP_dynam =
var n = SELECTEDVALUE('p_TOPN'[index])
var tab1 = ADDCOLUMNS( DISTINCT('Sheet1'[sales]),"rank",[rank_by],"qtySum",[qtySum])
var tab2 = ADDCOLUMNS( DISTINCT('Sheet1'[customer]),"rank",[rank_by],"qtySum",[qtySum])
var res1 = CALCULATE(FIRSTNONBLANK('Sheet1'[sales],'Sheet1'[sales]),FILTER(tab1,[rank]=n))
var res2 = CALCULATE(FIRSTNONBLANK('Sheet1'[customer],'Sheet1'[customer]),FILTER(tab2,[rank]=n))
return res1
7 REPLIES 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2023
08:40 PM

Hi,
Share the download link of the PBI file.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023
05:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023
08:40 PM

Cannot understand anything on that website.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023
11:51 PM

I have updated the information above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2023
03:11 PM

I still do not see any content in Engligh on that website. Could you share the download link from Google Drive/One Drive please?
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Announcements
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.

Recommendations
Subject | Author | Posted | |
---|---|---|---|
10-21-2024 10:02 PM | |||
Anonymous
| 01-31-2019 10:32 PM | ||
09-27-2022 01:39 AM | |||
05-20-2021 07:24 AM | |||
Anonymous
| 12-01-2021 03:27 AM |
Featured Topics
Top Solution Authors (Last Month)
User | Count |
---|---|
58 | |
55 | |
55 | |
37 | |
30 |
Top Kudoed Authors (Last Month)
User | Count |
---|---|
78 | |
64 | |
45 | |
42 | |
40 |