Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
3 years ago
Solved

Calculate total column value in power query

Hello everyone, I have a situation, I want to assemble a column of cumulative total of the value of the column "Rs" to be able to take an average of it.

This is the way I want to visualize it but it is calculated automatically because it comes from a database that they constantly update.

Thank you very much, I hope

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi ,

    Please have a try.

    Click on the 'Add Column' tab in the ribbon, and then select 'Custom Column'.In the 'Custom Column' dialog box, enter a name for the new column (e.g. 'Cumulative Total').In the 'Custom Column' dialog box, enter the following formula:

    = List.Sum(List.FirstN([Rs], CurrentRowIndex + 1))

    This formula calculates the cumulative total of the 'Rs' column up to the current row.

    Once you have created the cumulative total column, you can take an average of it by selecting the column and clicking on the 'Average' button in the 'Transform' tab of the ribbon.

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ,

    Please have a try.

    Click on the 'Add Column' tab in the ribbon, and then select 'Custom Column'.In the 'Custom Column' dialog box, enter a name for the new column (e.g. 'Cumulative Total').In the 'Custom Column' dialog box, enter the following formula:

    = List.Sum(List.FirstN([Rs], CurrentRowIndex + 1))

    This formula calculates the cumulative total of the 'Rs' column up to the current row.

    Once you have created the cumulative total column, you can take an average of it by selecting the column and clicking on the 'Average' button in the 'Transform' tab of the ribbon.

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.