Forum Discussion
tecumseh
3 years agoResolver III
TopN Returns Blank Calculated Table
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
Got it working with help from Gilbert Quevauvilliers in this article
My final DAX:TopN Sales Person =VAR __SelectedTop = SELECTEDVALUE(N_Values[NValues])RETURNSWITCH(TRUE(),__SelectedTop =0, [Total Sales],RANKX (ALLSELECTED(sales_performance[first_name] ),[Total Sales])<= __SelectedTop,[Total Sales])
2 Replies
- tecumsehResolver III
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])RETURNDIVIDE( __NValue,1, "There is an error" )
But my calculated table is still blank.Thanks,-w- tecumsehResolver III
Got it working with help from Gilbert Quevauvilliers in this article
My final DAX:TopN Sales Person =VAR __SelectedTop = SELECTEDVALUE(N_Values[NValues])RETURNSWITCH(TRUE(),__SelectedTop =0, [Total Sales],RANKX (ALLSELECTED(sales_performance[first_name] ),[Total Sales])<= __SelectedTop,[Total Sales])