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
tameemyousaf
Helper I
Helper I

Running Total Calculation

Hi,

 

I am facing the issues in calculating the running total for the given data. I have tried alot but failed to do that. I want to calculate the running total on the basis of net sales (descending order). I have used the RANKX function to the calculation of rank of for all Stores. Below is the screenshot of data:

 

Sales.jpg 

 

Below is the result that I want to calculate:

 

Result.jpg

6 REPLIES 6
PattemManohar
Community Champion
Community Champion

@tameemyousaf Please add an "Index" column in "Power Query Editor" and then use the below DAX as "New Column"

 

RunningTotal = CALCULATE(SUM(Test32RunningTotal[NetSales]),FILTER(Test32RunningTotal,Test32RunningTotal[Index]<=EARLIER(Test32RunningTotal[Index])))

image.png

 

Note - Please try to post the sample data in Copiable format.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




@PattemManohar Thanks for your response.

Actually the data in the table is not in this format. The data in the table is having date and items also. But I want to show the data in the given format in. I have tried using the index column but the attempt was not successful.

@tameemyousaf Please try to provide similar sample data that you're working on. So that it will be easy to replicate your issue and to provide solution as well.




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




I have data in below given format.

  

Data.jpg

 

I have a separate Stores table that makes a relationship with this Sales table (Stores.StoreKey = Sales.LocationKey). I am getting Store names from Stores table and sales qty. from Sales table. Below is the screenshot of Stores table:

 

Stores.jpg

@tameemyousaf,

 

You may just try the Quick measure Running total.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

 

Thanks for your response. I have also tried quick measure but it was not giving the required result.

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.