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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
crln-blue
Post Patron
Post Patron

Measure: Getting running total from previous week number

Hello! 

 

I have a measure that is a working running total for every week number and I also have another measure where it would display the last month's running total:

crln-blue_1-1608649107985.png

 

Ending Cash is the working running total for every week number. And Beginning Cash should display the last month's Ending Cash. However, I can't display it and I think my computation is wrong.  Below is the expected output:

Hierarchy1234
Beginning Cash481975526139.24700059.27512847.74
Ending Cash526139.24700059.27512847.74438.015.67

 

Data is sensitive and a lot of computations so I can't share it. Unfortunately, there is no week function on the DATEADD function. 

My column axis:

 

 

 

Week # = WEEKNUM(B[Date].[Date],1)

 

 

 

My ending cash calculated measure (running total):

 

 

Ending Cash Weekly = (SUMX(FILTER(ALLSELECTED('B'[Week #]),'B'[Week #] <= MAX('B'[Week #])),[Net Cash Flow Weekly])) + 'Query - Parameter'[Past Year End Cash Value]

 

 

 

My beginning cash calculated measure (the one I have problems with):

 

Beginning Cash Weekly = 
IF(SELECTEDVALUE('B'[Week #]) = 1,
    [Past Year End Cash Value],
    CALCULATE([Ending Cash Weekly], FILTER('B', 'B'[Week #] = SELECTEDVALUE('B'[Week #]) - 1)
    )
)

 

 

My question is, how do I compute for the Beginning Cash which takes the last period's running total? Thanks for the help!

3 REPLIES 3
amitchandak
Super User
Super User

@crln-blue , You want running total till last month ? of same week on week ?

This is till date

Cumm Sales = CALCULATE(SUM(Table[value]),filter(allselected(Table),Table[Date] <=max(Table[Date])))

 

Cumm Sales till last month = CALCULATE(SUM(Table[value]),filter(allselected(Table),Table[Date] <=max(dateadd(Table[Date],-1,month))))

//with date table

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=maxx(date,dateadd(date[date]),-1,month)))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@crln-blue , if you have date try like this for running total no need to week calculation, it can be part of date table

example

Cumm Sales = CALCULATE(SUM(Table[value]),filter(allselected(Table),Table[Date] <=max(Table[Date])))

 

Rest of the calculation is not clear to me

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak , thanks for the suggestion! However, my cummulative total is working okay now. I need to use it on week num since my column axis is week num.

 

Edited the post, I noticed that it's a bit unclear. My problem is how do I get the last month's running total. Thanks!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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