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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
OLoughanD
Helper I
Helper I

Running Total

Want to get a running total for each date by SalesReps, ordering by date (ie. Month column) ascending. I have highlighted in red what I am trying to achieve.

 

Capture.JPG

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

RunningTote = VAR _SPerson = TableX[sPerson]
              VAR _Day = TableX[day]
RETURN
    CALCULATE(SUM([dTarget]), 
        FILTER(TableX,
            TableX[day] <= _Day && 
            TableX[sPerson] = _SPerson))

Create a calculated column, swap in your table and column names.

 

Quick Tip : For better help, post sample data rather than a picture of the data

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @OLoughanD 

You could use Time-intelligence functions: TOTALYTDTOTALMTD

measre=CALCULATE([DailyTarget],DATESYTD('Date'[Date]))

 

or filter over the date column using FILTER called as below:

Measure= CALCULATE( SUM(DailyTarget),  FILTER (ALLSELECTED ( 'Date'[Date] ), AND ( 'Date'[Date] <= MAX ( 'Date'[Date] ), YEAR ( 'Date'[Date] ) = YEAR ( MAX ( 'Date'[Date] ) ) ) ) )

or

Measure= CALCULATE( SUM([DailyTarget]),  FILTER (ALLSELECTED ( 'Date'[Date] ), AND ( 'Date'[Date] <= MAX ( 'Date'[Date] ), AND ( YEAR ( 'Date'[Date] ) = YEAR ( MAX ( 'Date'[Date] ) ), MONTH ( 'Date'[Date] ) = MONTH ( MAX ( 'Date'[Date] ) ) ) ) ) )

 

Best Regards,
Lin

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

Hi,

 

Try this:

 

  1. Create a Calendar Table and build a relationship from the Date column of the Data Table to the Date column of the Calendar Table
  2. In your visual, drag Date from the Calendar Table and SalesRep from the Data Table
  3. Write these measures

Target = SUM(Data[DailyTarget])

RunningTotal = CALCULATE([Target],DATESYTD(Calendar[Date],"31/12"))

 

Hope this helps.


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

RunningTote = VAR _SPerson = TableX[sPerson]
              VAR _Day = TableX[day]
RETURN
    CALCULATE(SUM([dTarget]), 
        FILTER(TableX,
            TableX[day] <= _Day && 
            TableX[sPerson] = _SPerson))

Create a calculated column, swap in your table and column names.

 

Quick Tip : For better help, post sample data rather than a picture of the data

@HotChilliThank you very much. This worked perfectly. I added a column to my table and based on your proposed solution my final code was:

RunningTote = VAR _SPerson = Target[SalesPerson]
VAR _Day = Target[Date]
RETURN
CALCULATE(SUM([DateTarget]),
FILTER(Target,
Target[Date] <= _Day &&
Target[SalesPerson] = _SPerson))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors