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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Row based running total

Hi,

I have a table /matrix where i can show running total measure in a column but i would like to show it as row based in a martix. As a example:

Month AB
Jan 35
Total ?( running total till January)?( running total till January)
Feb 57
total ?( running total till February) ?( running total till February)
March 68

 

Thanks!

BR

Agreena

 

2 ACCEPTED SOLUTIONS

@Anonymous , If you use only a month, you will not get the total. Use two measures profit and Running total profit

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

 

Use date table, take month year from date table.

 

Enable Show on Row in matrix

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

v-jinweili-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

1. To add the “Total” rows , please create a new table:

 

Table 2 =
VAR _T1 =
    ADDCOLUMNS (
        DISTINCT ( 'Table'[Month] ),
        "Index", MONTH ( CONVERT ( [Month] & " 1", DATETIME ) )
    )
VAR _T2 =
    CROSSJOIN ( ROW ( "Month", "Total" ), { 1, 2 } )
RETURN
    UNION ( _T1, _T2 )

 

vjinweilimsft_0-1646992078894.png

2.Since there is only month name in your original table, please firstly extract Month Number ,which is used to compare.

 

Month Number =
MONTH ( CONVERT ( MAX ('Table' [Month] ) & " 1", DATETIME ) )

 

3.To match the value of “Month” and “Total”, please try:

 

Measure =
SWITCH (
    MAX ( 'Table 2'[Month] ),
    "Total",
        CALCULATE (
            SUM ( 'Table'[Profit] ),
            FILTER ( 'Table', [Month Number] <= MAX ( 'Table 2'[Index] ) )
        ),
    CALCULATE (
        SUM ( 'Table'[Profit] ),
        FILTER ( 'Table', [Month] = MAX ( 'Table 2'[Month] ) )
    )
)

 

Output:

vjinweilimsft_1-1646992184687.png

 

Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jinweili-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

1. To add the “Total” rows , please create a new table:

 

Table 2 =
VAR _T1 =
    ADDCOLUMNS (
        DISTINCT ( 'Table'[Month] ),
        "Index", MONTH ( CONVERT ( [Month] & " 1", DATETIME ) )
    )
VAR _T2 =
    CROSSJOIN ( ROW ( "Month", "Total" ), { 1, 2 } )
RETURN
    UNION ( _T1, _T2 )

 

vjinweilimsft_0-1646992078894.png

2.Since there is only month name in your original table, please firstly extract Month Number ,which is used to compare.

 

Month Number =
MONTH ( CONVERT ( MAX ('Table' [Month] ) & " 1", DATETIME ) )

 

3.To match the value of “Month” and “Total”, please try:

 

Measure =
SWITCH (
    MAX ( 'Table 2'[Month] ),
    "Total",
        CALCULATE (
            SUM ( 'Table'[Profit] ),
            FILTER ( 'Table', [Month Number] <= MAX ( 'Table 2'[Index] ) )
        ),
    CALCULATE (
        SUM ( 'Table'[Profit] ),
        FILTER ( 'Table', [Month] = MAX ( 'Table 2'[Month] ) )
    )
)

 

Output:

vjinweilimsft_1-1646992184687.png

 

Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , if you running across A and B value

 

sumx(filter(allselected(Table), Table[Month Year] = max(Table[Month Year])  && Table[Column] <= max(Table[Column]) ), Table[Value])

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
Anonymous
Not applicable

HI Amitchandak,

Thanks. Here runing total is not across two column, its based on per column. please just consider only one column (Profit)

Month Profit
Jan 4
Total ? (runing total til Jan)
Feb 7
Total  ?( running total till February)

@Anonymous , If you use only a month, you will not get the total. Use two measures profit and Running total profit

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

 

Use date table, take month year from date table.

 

Enable Show on Row in matrix

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

Helpful resources

Announcements
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.