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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nimai123
Post Patron
Post Patron

Running total/Cumulative sum

I have created a measure 1 and I want to create a running total measure depending upon the measure 1, I have been through many blogs and links on the internet but not able to get the desired output 

 

Running total Measure would in the form as if it has data in the current week should add with the next value and if there is no data in the next value it should display the same value and move forward.

 

Sample Expected output

Capture.PNG

 

Measure using to calculating the sales is 

 

Final Open Stragglers Low Risk =
var qr = SELECTEDVALUE('Qtr'[Qtr Name])
var wn = SELECTEDVALUE(Qtr[Week Num])
return
CALCULATE(Sum(bookings_reporting_view[line_item_acv_price_converted]),
bookings_reporting_view[med_fq_Qtr Name] < qr,
bookings_reporting_view[cld_weekhelp] = wn,
OR(bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution"},bookings_reporting_view[stage] in {"4 - Renewal Procurement","5 - Manage Procurement"}),
bookings_reporting_view[isclosed] = {"0"})
 
Measure using to calculating running total is 
 
Running Open Stragglers Low Risk =

CALCULATE(Sum(bookings_reporting_view[line_item_acv_price_converted]),
FILTER(ALLSELECTED(bookings_reporting_view),
bookings_reporting_view[med_fq_Qtr Name] < MIN(Qtr[Qtr Name])&&
bookings_reporting_view[cld_weekhelp] <= MIN(Qtr[Week Num])&&

OR(bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution"}, bookings_reporting_view[stage] in {"4 - Renewal Procurement","5 - Manage Procurement"})
&& bookings_reporting_view[isclosed] = {"0"}))
 
Capture1.PNG
 
Relationship
Capture2.PNG
 
2 ACCEPTED SOLUTIONS

@Nimai123 , Try like

Running Open Stragglers Low Risk = 
Var a = MINX(ALLSELECTED(Qtr),Qtr[Week Num])
Return
CALCULATE(Sum(bookings_reporting_view[line_item_acv_price_converted]),
FILTER(ALLSELECTED(bookings_reporting_view),
bookings_reporting_view[med_fq_Qtr Name] < MIN(Qtr[Qtr Name])&&
bookings_reporting_view[cld_weekhelp] <= MIN(Qtr[Week Num])&&
bookings_reporting_view[cld_weekhelp] >= a &&

OR(bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution"}, bookings_reporting_view[stage] in {"4 - Renewal Procurement","5 - Manage Procurement"})
&& bookings_reporting_view[isclosed] = {"0"}))
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

View solution in original post

@Nimai123 ,

 Try below measure to get your expected result:

 
Running Stragglers Low Risk=
Var Res = CALCULATE(sum(bookings_reporting_view[line_item_acv_price_converted]),
FILTER(ALLSELECTED(bookings_reporting_view),
bookings_reporting_view[med_fq_Qtr Name] < MIN(Qtr[Qtr Name]) &&
bookings_reporting_view[cld_weekhelp] <=MIN(Qtr[Week Num]) &&
bookings_reporting_view[cld_weekhelp] >= (CALCULATE(MIN(Qtr[Week Num]),FILTER(ALLSELECTED(Qtr),Qtr[Week Num]<=MIN(Qtr[Week Num]))))
&& bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution" } &&
bookings_reporting_view[isclosed] = {"0"}))
RETURN Res
 
 
 
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Nimai123 , I done with Qtr Rank and week No. Week no, you use you calc

Start of Year = STARTOFYEAR(Dates[Date],"1/31")
Qtr No = "Q"& QUOTIENT(DATEDIFF(Dates[Start of Year], Dates[Date],MONTH),3)+1
Strat of Qtr = date(year(Dates[Start of Year]), month(Dates[Start of Year])+Dates[Add Qtr],1)
Add Qtr = QUOTIENT(DATEDIFF(Dates[Start of Year], Dates[Date],MONTH),3)*3
FW in Quarter = Your week formula

 

Qtr = CALCULATE([measure], FILTER(ALL(Dates), Dates[Qtr Rank] =max(Dates[Qtr Rank]) && Dates[FW in Quarter] = Max(Dates[FW in Quarter])))
Qtr Running Total New = CALCULATE([measure],, FILTER(ALL(Dates), Dates[Qtr Rank] =max(Dates[Qtr Rank]) && Dates[FW in Quarter] <= Max(Dates[FW in Quarter])))

 

LQ = CALCULATE([measure], FILTER(ALL(Dates), Dates[Qtr Rank] =max(Dates[Qtr Rank])-1 && Dates[FW in Quarter] = Max(Dates[FW in Quarter])))
LQ Running Total New = CALCULATE([measure],, FILTER(ALL(Dates), Dates[Qtr Rank] =max(Dates[Qtr Rank])-1 && Dates[FW in Quarter] <= Max(Dates[FW in Quarter])))

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

@Nimai123 , Try like

Running Open Stragglers Low Risk = 
Var a = MINX(ALLSELECTED(Qtr),Qtr[Week Num])
Return
CALCULATE(Sum(bookings_reporting_view[line_item_acv_price_converted]),
FILTER(ALLSELECTED(bookings_reporting_view),
bookings_reporting_view[med_fq_Qtr Name] < MIN(Qtr[Qtr Name])&&
bookings_reporting_view[cld_weekhelp] <= MIN(Qtr[Week Num])&&
bookings_reporting_view[cld_weekhelp] >= a &&

OR(bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution"}, bookings_reporting_view[stage] in {"4 - Renewal Procurement","5 - Manage Procurement"})
&& bookings_reporting_view[isclosed] = {"0"}))
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

@Nimai123 ,

 Try below measure to get your expected result:

 
Running Stragglers Low Risk=
Var Res = CALCULATE(sum(bookings_reporting_view[line_item_acv_price_converted]),
FILTER(ALLSELECTED(bookings_reporting_view),
bookings_reporting_view[med_fq_Qtr Name] < MIN(Qtr[Qtr Name]) &&
bookings_reporting_view[cld_weekhelp] <=MIN(Qtr[Week Num]) &&
bookings_reporting_view[cld_weekhelp] >= (CALCULATE(MIN(Qtr[Week Num]),FILTER(ALLSELECTED(Qtr),Qtr[Week Num]<=MIN(Qtr[Week Num]))))
&& bookings_reporting_view[stage] in {"1 - Discover Opportunity","1 - Renewal Opportunity","2 - Renewal Initiated","3 - Renewal Low Risk","2 - Qualify Opportunity","3 - Validate Solution" } &&
bookings_reporting_view[isclosed] = {"0"}))
RETURN Res
 
 
 
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Greg_Deckler
Community Champion
Community Champion

@Nimai123  - Sample source data would help. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.

 

But, the general pattern is:

Cumulative Measure =
  VAR __Current = [Weeknum]
  VAR __Table = 
      SUMMARIZE(
        FILTER('Table',[Weeknum] <= __Current),
        [Weeknum],
        "Measure",[Measure]
      )
RETURN
  SUMX(__Table,[Measure])
   


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, Greg

 

The data is confidential so I will be sending you the sample data file on Personal chat, hope it works.

 

The result required when selecting FY21-Q1 in the slicer

 

Capture3.PNG

@Greg_Deckler 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.