Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Data Modeling Power Query, Operations between rows

Hello Everyone¡¡ I am new in this community and I would like in advantage for your support.    My two questions are:   1) I'm working with a query, and I need to get the immediate value of the pr...
  • Anonymous's avatar
    Anonymous
    7 years ago

    You can use an index column starting at zero with this code for a new column:

    try 
    List.Sum(
        List.Range(
             #"Added Index"[Total Sales],
             [Index]-1,
             1
        )
    )
    otherwise
    0

     

    For your other question, you can group by those columns and get a distinct count. It may not be your ideal solution, but it's at least a starting point.