I want to do a running total with power query like I did with Tableau software before. Does anyone have ideas, thanks in advance!
相关问题
- How to join two tables in PowerQuery with one of m
- Bridge tables - DAX or M?
- How to refresh report that uses custom functions o
- Power Query column name as parameter
- How can I expand all lists in a row of lists at th
相关文章
- Power Query to Filter a SQL view based on an Excel
- Always Allow Native DB Queries
- SUM IF in Power BI
- Add missing date rows in Power BI/Power Query and
- Auto-updating Power Query Connection via VBA
- Replace all error values of all columns after impo
- How to automate a power query in VBA?
- What's the difference between DAX and Power Qu
I mean this code from Adam works but with adding " behind "Running Total:
Step 1: Add an index
Step 2: Add a running total
I think if it is possible in Power Query it would be very complicated. It's just the wrong tool. Use Power Query to bring the data into Power Pivot and create the running total there instead. It is a standard pattern. See this excellent guide: http://www.daxpatterns.com/cumulative-total/
I believe the best technique so far is creating a list and then creating another column using List.Sum. This does not require any complicated codes. Just point and click and will solve the issue.
More details: https://www.sumproduct.com/blog/article/power-query-one-route-to-a-running-total
Apologies for the very late answer - this challenge has been nagging at me for many months.
There are few solutions floating around forums and blogs but they all seem to need pages of custom M code. Some also cant meet the common requirement of needing to restart the running total when a group changes.
So I came up a with a technique you can build without writing any custom code - you just click around in the Power Query window and add one very simple Custom Column.
The key steps are:
[Index] >= [#"All Rows - Copy.Index"]
I built a working solution which you can download from my OneDrive and try out:
http://1drv.ms/1AzPAZp
It's the file: Power Query demo - Running Total
Very easy.
Step 1: Add an index
Step 2: Add a running total
Using Excel 2016,
Add Index named "RunningTotal"
Go to Query -> Edit -> Add Reference Query (Index must be a column within Source**
Go to View -> Advanced Editor and paste the below code to create a function:
Rename the query to fnRunningTotal
To use the function: