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

How to calculate the accumulated sum of the previous month?

Hello everyone

 

I have a table with the values ​​below.

edwinchagas_0-1725479057292.png

 

I can show the sum of the base value of the current month (according to the selected date filter), but I would also like to show the accumulated sum value of the previous month.

 

The sum of the current month is calculated as follows:

Sum Base Actual month = CALCULATE(COUNTROWS['Table'],FILTER(ALLSELECTED('Calendar'),'Calendar'[Date] <= EOMONTH(TODAY(),0)))

 

The value (per day) of the previous month is calculated:

Sum Base Previous month = CALCULATE(COUNTROWS['Table'],DATEADD('Calendar'[Date],-1,MONTH))

 

I need to show the total value of the previous month (382) in all rows (as well as Sum Base Actual Month). How could I do this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @edwinchagas ,

 

You can try this measure.

Measure 3 = 
VAR _count =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] <= EOMONTH ( MAX ( 'Calendar'[Date] ), -1 )
                && 'Calendar'[Date]
                    >= EOMONTH ( MAX ( 'Calendar'[Date] ), -2 ) + 1
        )
    )
RETURN
    _count

 

vkaiyuemsft_0-1725518253043.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any 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
Anonymous
Not applicable

Hi @edwinchagas ,

 

You can try this measure.

Measure 3 = 
VAR _count =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] <= EOMONTH ( MAX ( 'Calendar'[Date] ), -1 )
                && 'Calendar'[Date]
                    >= EOMONTH ( MAX ( 'Calendar'[Date] ), -2 ) + 1
        )
    )
RETURN
    _count

 

vkaiyuemsft_0-1725518253043.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Wow!

 

Your solution is working like a charm!

 

Thank you!

lbendlin
Super User
Super User

but I would also like to show the accumulated sum value of the previous month.

Since that month is completely in the past the running total equals the sum.   Are you trying to show partial sums somehow?

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.  If possible, could you ensure that data in that file is in English?


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

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.