Is there an ETL function for counting row?

Options
The Hackett Group
The Hackett Group Active Partner
Level 200: Leveraging Board for Business Insights Level 100: Foundations of Building in Board Name Dropper First Comment

Hi,

I've got a cube that requires a line reference number as a dimension (from the load table) - I'd like to add a row counter to the ETL in the data reader where this cube is populated, but I'm not sure what the function would be (or if one exists).

Does anyone know what the function is or a workaround?

Thanks!

Accepted Answers

Answers

  • Tommaso Riva
    Tommaso Riva Employee
    First Anniversary Level 100: Foundations of Building in Board Level 200: Leveraging Board for Business Insights First Answer
    Options

    @The Hackett Group have you tried exploiting the ROW(reference)function?

    This function returns the row number of the supplied reference.

  • The Hackett Group
    The Hackett Group Active Partner
    Level 200: Leveraging Board for Business Insights Level 100: Foundations of Building in Board Name Dropper First Comment
    Options

    Hi Tommaso, thanks for your reply!

    I was not aware of the function - do you know what I would use as a reference?

    Any cell reference I try returns the row number in the ETL, not the row number of the table (C25 = 25 for example).

  • Tommaso Riva
    Tommaso Riva Employee
    First Anniversary Level 100: Foundations of Building in Board Level 200: Leveraging Board for Business Insights First Answer
    Options

    @The Hackett Group You could option for a dynamic reference by using a nested function.

    In general, It is always reliable to have the row number already provided in the source table.

  • Filip Rankovic
    Options

    Hi @The Hackett Group

    In case you are using a SQL DataReader and depending on the desired use case, the SQL row_number() function might do the trick:

    select row_number() over (order by {column to count} desc) as index_new_name, {other desired fields}
    from table

    Pleas, let me know if that helped.

    Best regards,
    Filip

    ————————————-
    FIlip Rankovic
    Consultant
    Board Deutschland GmbH

  • Nitish Subramanian
    Nitish Subramanian Active Partner
    Name Dropper First Anniversary Level 100: Foundations of Building in Board First Comment
    Options

    Hi Tomaso,

    If you don't mind, can you please share how nested functions can be used in ETL to determine row counts?

  • Tommaso Riva
    Tommaso Riva Employee
    First Anniversary Level 100: Foundations of Building in Board Level 200: Leveraging Board for Business Insights First Answer
    Options

    Hi @Nitish Subramanian,

    to know the number of rows, you need to place some temporary tiles to get there.

    For example, add a rank to establish a row number column, then aggregate with a group to get the maximum row.