Forum Discussion
Add row number to Filtered table
Hello,
I need to add to my table view a row_number column which needs to reset based on the selection. For example, if I select the territory Canada, I need to have row_numbe from 1 to 100 let's say, if I change the selection to US I need to have 1 to 50.
I have tried the solution from the community with adding an index and creating a measure:
Row_Number =
CALCULATE (
COUNTROWS(table),
FILTER ( ALLSELECTED (table ), table[Index] <= MAX ( table[Index]) )
) but the result is not the desired one ( I get 4, 8, 11, 14...). I have also filters applied in the Filter Pane from the right..
Thank you.
5 Replies
- amitchandakSuper User
Anonymous , try if rank can help
I logged idea for that : Serial No in Visual Table
https://ideas.powerbi.com/ideas/idea/?ideaid=80612ec5-14a9-4929-a2ee-531943fa51d4For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415 - Greg_DecklerCommunity Champion
Anonymous - Sample data would help, but maybe the Mythical DAX Index? https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Mythical-DAX-Index/m-p/1093214#M528
Or maybe something dealing with RANKX? https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452
Or maybe Cthulhu? https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/m-p/509739#M211
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.- AnonymousNot applicable
Hello Greg_Deckler , I am trying to achieve what is described here, I am using the exact same functions but my row number column has the value 1 for all rows.
- Greg_DecklerCommunity Champion
Anonymous - I don't have an example of what your data looks like, but I mocked something up. See what you think. PBIX is attached below sig, Table 12, Measure 12, Page 12.