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

TopN Returns Blank Calculated Table
05-04-2023
11:08 AM
Hi all,
I am trying to return a Calculated Table with TopN where user selects the N from a Slicer disconnected table of values
[Get SelectedN] then returns what the user selected from the slicer.
What am I doing wrong?
Top Sales for N =
TOPN([Get Seleted N],
SUMMARIZE(
sales_performance,
sales_performance[first_name],
"Total Sales", SUM(sales_performance[Sales])
),
[Total Sales], DESC
)
Thanks,
-w
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023
04:04 PM

Got it working with help from Gilbert Quevauvilliers in this article
My final DAX:
TopN Sales Person =
VAR __SelectedTop = SELECTEDVALUE(N_Values[NValues])
RETURN
SWITCH(
TRUE(),
__SelectedTop =0, [Total Sales],
RANKX (
ALLSELECTED(sales_performance[first_name] ),
[Total Sales]
)
<= __SelectedTop,
[Total Sales]
)
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023
02:59 PM

I fixed my model and my DAX and this does work:
Top Sales for N =
TOPN(10,
SUMMARIZE(
dimSalesPeople,
dimSalesPeople[first_name],
"Total Sales", SUM(sales_performance[Sales])
),
[Total Sales],DESC
)
Seems my problem is with my SELECTEDVALUE, I tried:
Get Seleted N =
VAR __NValue = SELECTEDVALUE(N_Values[NValues])
RETURN
DIVIDE( __NValue,1, "There is an error" )
But my calculated table is still blank.
But my calculated table is still blank.
Thanks,
-w
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023
04:04 PM

Got it working with help from Gilbert Quevauvilliers in this article
My final DAX:
TopN Sales Person =
VAR __SelectedTop = SELECTEDVALUE(N_Values[NValues])
RETURN
SWITCH(
TRUE(),
__SelectedTop =0, [Total Sales],
RANKX (
ALLSELECTED(sales_performance[first_name] ),
[Total Sales]
)
<= __SelectedTop,
[Total Sales]
)

Helpful resources
Announcements
Recommendations
Subject | Author | Posted | |
---|---|---|---|
03-04-2024 02:13 AM | |||
07-04-2024 10:37 PM | |||
Anonymous
| 04-02-2024 06:27 AM | ||
02-06-2024 07:51 AM | |||
03-23-2023 10:36 AM |
Featured Topics
Top Kudoed Authors (Last Month)
User | Count |
---|---|
101 | |
69 | |
56 | |
47 | |
47 |