Forum Discussion
Top N with Parameter?
- 9 years ago
You would only need to add additional ALLSELECTED parameters to CALCULATETABLE if you are putting those additional columns on axes (or rows/columns) of the visual itself. If you are simply adding more slicers, then the existing measure would be fine.
However, a better way of defining the measure to capture all possibilities would be:
MyTopN3 = CALCULATE ( SUM ( LAWCrime[Violent crime total] ), KEEPFILTERS ( CALCULATETABLE ( TOPN ( [SelectedN], VALUES ( LAWCrime[State] ), CALCULATE ( SUM ( LAWCrime[Violent crime total] ) ) ), ALLSELECTED () ) ) )This uses ALLSELECTED () without arguments to ensure that the ranking is carried at the total level of the visual (this also means you can change ALLSELECTED ( LAWCrime[State] ) to VALUES ( LAWCrime[State] ).
If you want to rank by something other than state then just change the red part.
Cheers,
Owen :)
I will like it to appear like mentioned:
Item 1
Item 2
Item 3
Item 4
Item 5
Others
Also, I want to have a scenario where if I hover over any of the values above, it will show the value and the measure.
Eg. If I hover over Item 1, I will see Item 1 and the corresponding value for Item 1 and then if I hover others, I will see all the Items that were grouped as Others and their values.
Anonymous
Just catching up on replying to this one.
I would suggest an approach such as the one in this article for setting up the data model.
https://www.sqlbi.com/articles/showing-the-top-5-products-and-others-row/
Please post back if needed.
Regards,
Owen