Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Create a new sort column based in two columns relationship (sequence)

In Power BI, I have a table called ESTRUTURAS that has two columns: one called 'Equipamento' (name of the equipment) and the other 'EquipamentoVante' which determines the name of the next equipment i...
  • OwenAuger's avatar
    2 years ago

    Hi Anonymous 

    I believe we can do something with PATH functions. Exact code would depend on the structure of the data.

    Could you post a sample of the ESTRUTURAS table? 

    Questions:

    • Is each value in Equipamento unique?
    • If not unique, then is there a grouping column (like Order ID or something else) which groups Equipamento into sets of unique values?

    Regards

  • Anonymous's avatar
    Anonymous
    2 years ago

    Great solution.
    I had to create a column inverting the relationship (a column that informs the previous equipment, instead of the one that existed informing the next equipment).
    Then just apply the PATH and PATLENGTH functions.

    Problem solved.
    Thank you very much.