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
jof4
New Member

Sum multiple rows of a Matrix by summing all months up to the previous month

I am trying to convert a dashboard I made on excel onto PowerBI, however, I am a complete novice with powerBI so all help is greatly appreciated.

 

With excel, i used the formual =SUM(OFFSET($E$14,0,0,1,MONTH(TODAY())-1)) 

 

Below is a basic example of the dashboard I have (the months would run all the way to december).

In addition to the year total column, I would like an additional column which sums all the months values to the end of the previous month. In this example, it should sum from Jan to Apr. If the month was October, it shoudl sum from Jan to Sep.  

 

I am really struggling with this so any help would be greatly appreciated. 

Thanks!

 

 JanFebMarAprMayYear TotalYear to previous month total
New Business100,00050,000150,000250,000100,000650,000550,000
Renewed Business75,00025,000100,000100,000100,000400,000300,000
Lapsed Business50,00025,00050,00025,00030,000180,000150,000
Commission10%5%15%20%15%13%12.5%
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jof4 ,

I create a sample pbix file(see the attachment), please check if that is what you want.

Year to previous month total =
VAR _maxmonth =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) )
VAR _pmtotal =
    CALCULATE (
        SUM ( 'Table'[value] ),
        FILTER (
            'Table',
            'Table'[Date] >= DATE ( 2023, 1, 1 )
                && 'Table'[Date] <= EOMONTH ( _maxmonth, -1 ) //EOMONTH ( TODAY (), -1 )
        )
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Date].[Month] ), SUM ( 'Table'[Value] ), _pmtotal )

vyiruanmsft_0-1696574401195.png

 

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @jof4 ,

I create a sample pbix file(see the attachment), please check if that is what you want.

Year to previous month total =
VAR _maxmonth =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLSELECTED ( 'Table'[Date] ) )
VAR _pmtotal =
    CALCULATE (
        SUM ( 'Table'[value] ),
        FILTER (
            'Table',
            'Table'[Date] >= DATE ( 2023, 1, 1 )
                && 'Table'[Date] <= EOMONTH ( _maxmonth, -1 ) //EOMONTH ( TODAY (), -1 )
        )
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Date].[Month] ), SUM ( 'Table'[Value] ), _pmtotal )

vyiruanmsft_0-1696574401195.png

 

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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