Forum Discussion
How to create index on visual table
- 2 years ago
Harineeeeeeee The index column is not displaying unique values because of the ALLSELECTED function.
You can try using ALL('MainTable') instead of ALLSELECTED('MainTable')
IndexColumn = RANKX(ALL('MainTable'), 'MainTable'[id], , ASC, Dense)Or
Index = COUNTROWS(FILTER(ALL(MainTable), MainTable[id] < EARLIER(MainTable[id]))) + 1I hope this meets your needs. If so, please consider Accepting it as the solution to help others find it more quickly. OR
If my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!Best Regards,Dallas.
Harineeeeeeee your approach is right.
You can modify the query using the following formulas
IndexColumn = RANKX(ALLSELECTED('MainTable'), 'MainTable'[id], , ASC, Dense)
or
Index = COUNTROWS(FILTER(ALLSELECTED(MainTable), MainTable[id] <= EARLIER(MainTable[id])))
Let me know if this works for you. @ me in replies, or I'll lose your thread!!!
Note:
If my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
Thanks for the below, now the values are not unique but it gives me some random number not realy sure on what basis that random number is coming, even though i used maintabl[id] as index column which starts from 0.
Any thoughts on this?
Thanks
- DallasBaba2 years ago
Skilled Sharer
Harineeeeeeee The index column is not displaying unique values because of the ALLSELECTED function.
You can try using ALL('MainTable') instead of ALLSELECTED('MainTable')
IndexColumn = RANKX(ALL('MainTable'), 'MainTable'[id], , ASC, Dense)Or
Index = COUNTROWS(FILTER(ALL(MainTable), MainTable[id] < EARLIER(MainTable[id]))) + 1I hope this meets your needs. If so, please consider Accepting it as the solution to help others find it more quickly. OR
If my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!Best Regards,Dallas.- Harineeeeeeee2 years ago
Helper I
DallasBaba Thanks and Kudos! It worked