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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
MSMKM
Helper I
Helper I

how to achieve running total

Hi Team,

 

i have a table below which i need running table , how we can achieve

first 3 columns we can get from SQL data base and how we can make it output

 

Product

Date

No. of units sold

Output

A

1/1/2023

90

90

A

1/12/2023

100

190

A

1/15/2023

150

340

A

1/4/2023

123

463

B

1/5/2023

300

300

B

1/6/2023

400

700

B

1/7/2023

500

1200

B

1/8/2023

600

1800

C

1/12/2023

60

60

C

1/15/2023

70

130

C

2/11/2023

80

210

C

2/12/2023

90

300

 

 

 

3 REPLIES 3
FreemanZ
Super User
Super User

or you implement with a measure:

Measure = 
VAR CurrentProduct = MAX(TableName[Product])
VAR CurrentDate = MAX(TableName[Date])
RETURN
    SUMX(
        FILTER(
            ALL(TableName),
            TableName[Product]=CurrentProduct
                &&TableName[Date]<=CurrentDate
        ),
        TableName[No. of units sold]
    )

FreemanZ_2-1681306036079.png

FreemanZ
Super User
Super User

hi @MSMKM

try to add a calculated column like:

 

Output2 = 
SUMX(
    FILTER(
        TableName,
        TableName[Product]=EARLIER(TableName[Product])
            &&TableName[Date]<=EARLIER(TableName[Date])
    ),
    TableName[No. of units sold]
)

 

FreemanZ_0-1681305766101.png

 

or 

Output3 = 
VAR CurrentProduct = [Product]
VAR CurrentDate = [Date]
RETURN
    SUMX(
        FILTER(
            TableName,
            TableName[Product]=CurrentProduct
                &&TableName[Date]<=CurrentDate
        ),
        TableName[No. of units sold]
    )

FreemanZ_1-1681305858759.png

 

 

Alf94
Solution Supplier
Solution Supplier

Hi @MSMKM ,

 

You can create this measure and add it to your visual:

 

 

Running total = 
    SUMX(
        WINDOW(
            1, ABS,
            0, REL,
            ORDERBY(
                'Table'[Product], ASC,
                'Table'[Date], ASC
            )
        ),
        CALCULATE( SUM( 'Table'[No. of units sold] ) )
    )

 

 

I think this can do the trick.

 

Best,

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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