Forum Discussion
Top # on a new Table based on Count
- 6 years ago
Hi Anonymous ,
Try this:
Lan Count = TOPN ( 10, ADDCOLUMNS ( SUMMARIZE ( Calls, Calls[Language] ), "Count", CALCULATE ( COUNTA ( Calls[Language] ) + 0, Calls[Checked] = "True" ) ), CALCULATE ( COUNTA ( Calls[Language] ) + 0, Calls[Checked] = "True" ) + RANKX ( Calls, Calls[Language],, DESC, DENSE ) / 10000 )For TOPN, we should pay attention to this:
If there is a tie, in order_by values, at the N-th row of the table, then all tied rows are returned. Then, when there are ties at the N-th row the function might return more than n rows.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
I create an example:
And get the result below using your DAX expression:
Then create another table using the DAX expression below and get the result you want.
Lan Count =
TOPN (
5,
ADDCOLUMNS (
SUMMARIZE ( Calls, Calls[Language] ),
"Count", CALCULATE ( COUNTA ( Calls[Language] ), Calls[Checked] = "True" )
),
CALCULATE ( COUNTA ( Calls[Language] ), Calls[Checked] = "True" )
)Can this meet your requirements?
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
It works if I do Top 5, even if the count repeats, I only get 5, if I try to do a Top 10, it returns more than 10, I have no idea why.
Edit: If I do a top 15 it works, I am more confused now, only if I try to do anything between Top 7 and Top 12 it returns more, but for top 5 and top 15 it only returns 5 or 15, even if there are duplicate Counts.