The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
is there a way to select topn of a calculated table by slicer?
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
1. I have 2 tables from Excel (toptop.xlsx, topn.xlsx).
2. toptop.xlsx delivers data to calculate the topn of it selected; topn selected from the excel topn.xlsc (1 to 10).
3. My Dax-code is a calculated table to return the ranked topn-list.
4. is it possible to make a slicer, so the user can select the number of topN?
The result should be looking like:
TabelleTopN =
VAR TopNTabelle =
SUMMARIZE(
TOPN(
SelectionValue,
SUMMARIZE(
DeineTabelle,
DeineTabelle[Land],
"Anzahl",
DISTINCTCOUNT(
DeineTabelle[ID]
)
),
[Anzahl], DESC
),
DeineTabelle[Land],
"Anzahl",
DISTINCTCOUNT(
DeineTabelle[ID]
)
)
VAR TopNTabelleRang =
ADDCOLUMNS(
TopNTabelle,
"Rang",
RANKX(
TopNTabelle,
[Anzahl],
[Anzahl], DESC
)
)
RETURN TopNTabelleRang
SelectionValue |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Land | ID |
Australien | 55 |
Australien | 56 |
Australien | 57 |
Australien | 58 |
Australien | 59 |
Australien | 60 |
Australien | 61 |
Australien | 62 |
Australien | 63 |
Australien | 64 |
China | 66 |
China | 95 |
China | 11 |
Deutschland | 34 |
Deutschland | 19 |
Deutschland | 44 |
Deutschland | 63 |
Großbritannien | 50 |
Spanien | 45 |
Spanien | 89 |
Spanien | 14 |
Spanien | 33 |
Spanien | 67 |
USA | 1 |
USA | 2 |
USA | 3 |
USA | 4 |
USA | 5 |
USA | 6 |
USA | 7 |
USA | 8 |
USA | 9 |
USA | 10 |
USA | 11 |
USA | 12 |
USA | 13 |
USA | 14 |
USA | 15 |
USA | 16 |
USA | 17 |
USA | 18 |
USA | 19 |
USA | 20 |
USA | 21 |
USA | 22 |
USA | 23 |
USA | 24 |
USA | 25 |
USA | 26 |
USA | 27 |
USA | 28 |
USA | 29 |
USA | 30 |
Nigeria | 77 |
Nigeria | 78 |
Nigeria | 79 |
Nigeria | 80 |
Nigeria | 81 |
Nigeria | 82 |
Nigeria | 83 |
Nigeria | 84 |
Nigeria | 85 |
Nigeria | 86 |
Kolumbien | 55 |
Kolumbien | 56 |
Kolumbien | 57 |
Kolumbien | 58 |
Yes, that is possible. There are some nuances, they are well described in this article: Use of RANKX in Power BI measures - SQLBI
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |