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
kiranbchitari
Frequent Visitor

How to calculate running balance with similar dates ?

I want to calculate the running balance in the attached .pbix file. The problem with the data set is dates are repeated, so I can't use order on the basis of dates, And the data set is having multiple account details, so If I use Index column then after changing the account using filter, the ordering of Index column is also changed, so, that also not works for me, even I tried with RANKX function but I am not able to get the desired running balance( cumulative total).  The cumulative sum of Accounted Amount can give the running balance.

 

I tried with adding index column, sorted on account column. But I am facing an issue that for 2222 Account (Fig. 1)it is showing correct running balance as the index starts from 1, but for 11111 Account(Fig. 2) it is showing wrong value as the index column is not started with 1 this time, it continues with  37. So I tried RANKX function but even that not works. So please help me with any DAX formula which can be used for calculating Running BalanceFig. 1Fig. 1

 

 

 Fig. 2Fig. 2

I am attaching the .pbix file.

https://drive.google.com/open?id=1bkWbZxO3gMdswWDEv0bDUcfFpWYrAqqB

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=CALCULATE(SUM('Sheet1'[Accounted Amount]),FILTER(ALLEXCEPT('Sheet1',Sheet1[Account]),'Sheet1'[Index]<=MAX('Sheet1'[Index])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=CALCULATE(SUM('Sheet1'[Accounted Amount]),FILTER(ALLEXCEPT('Sheet1',Sheet1[Account]),'Sheet1'[Index]<=MAX('Sheet1'[Index])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur

Thanks for your response, is it possible to calculate running balance if I don't have an Index column. I added index column because I thought there is no other option. Is it possible with Date column(Having repeated dates)?

Hi,

 

You are welcome.  If my previous reply helped, please mark it as Answer.  On taking away the Index column, all transactions on the same day will get grouped (So there will be one line item per day).


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur Thanks for your help.Smiley Wink

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.