Is there a way to create row numbers that count only when a value changes ...

User: "Justin_21746"
Altair Community Member
Updated by Justin_21746

Hello,

I was wondering is there a way to create rows numbers that count only when a value changes, i.e. three rows of data, the first two row ids are CD and the third is TAPE, I would want it to restart the row count when the value changes from CD to TAPE.



------------------------------
Justin Marroquin
Financial Analyst
Dssw, LLC
San Antonio TX
(210) 845-6651
------------------------------

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "CPorthouse"
    Altair Employee
    Accepted Answer
    Updated by CPorthouse
    Hopefully the following makes sense.  I am using classic.prn to create this example.  I skipped the modeling portion.  Once you have the data modeled, I added a couple of metadata columns (ReportPage and ReportLine):
    image
    I then grouped my table (Transform -> Group) on Order number and Media and aggregated on ReportPage and ReportLine (using the minimum):
    image


    I then combined by GroupBy table with the original Classic table using Combine->Join Tables->Lookup:
    image
    This will bring back the first row for each value change (Order # and Media).
    Add a formula column to calculate the difference between the minimum reportline and the original one and add 1 (so it won't be zero based):
    image
    Hopefully this gets you started.




    ------------------------------
    Chris Porthouse
    Professional services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 11-13-2020 12:39 PM
    From: Justin Marroquin
    Subject: Is there a way to create row numbers that count only when a value changes ...

    Hello,

    I was wondering is there a way to create rows numbers that count only when a value changes, i.e. three rows of data, the first two row ids are CD and the third is TAPE, I would want it to restart the row count when the value changes from CD to TAPE.

    ------------------------------
    Justin Marroquin
    Financial Analyst
    Dssw, LLC
    San Antonio TX
    (210) 845-6651
    ------------------------------