Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mansi64011
Frequent Visitor

Running total in Power Query

Hello,
I wanted to create a Running Total column in Power Query.
I have an Invoice Table which looks like below:
Account IDInvoice Date Invoice PriceRunning Total
110/13/20165050
112/10/2017279329
12/23/201813801709
24/15/2018325325
23/4/20197871112
36/19/201822
49/10/201723562356
47/30/2018352391
49/9/20182542645
45/7/20197563401
53/12/20173737
58/26/2018876913

My SQL code for that is:
SELECT SUM(InvoicePrice) OVER (Partition by AccountID Order by InvoiceDate) as RunningTotal
FROM Invoices
 
Note: 1 account can have many invoices so I partitioned by account ID as I want to see running total for each account.
1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

1 REPLY 1
ImkeF
Super User
Super User

Hi @mansi64011 

please check out this solution: https://www.thebiccountant.com/2018/09/30/memory-efficient-clustered-running-total-in-power-bi/ 

 

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors