Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Adding index number based on category

Hello, folks! How can I add an index number that runs based on category type stated in another column? See the example picture. This is what I want to achiecve. I'd like the index column to give a...
  • LivioLanzo's avatar
    LivioLanzo
    7 years ago

    What if you add another column called FkDte with this formula

     

    =Table1[Date]+RANDBETWEEN(1,1000) / 10000

     

    and then add another columns with this formula

     

    =CALCULATE(
    COUNTROWS( Table1 ),
    ALLEXCEPT( Table1, Table1[Category] ),
    Table1[FkDte] < EARLIER( Table1[FkDte] )
    ) + 1

     

     

    by the way, do you only have 2 columns in the original table (Date, Category), or do you have other columns that could avoid the usage of the FkDte column?