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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
pradeepnani
New Member

Hi Team, I have been working on a report where I want to display cumulative total of last 3 months

Cumulative total of last 3 months along with the previous added values

Hi Team,

I have been working on a report where I want to display the cumulative total of last 3 months along with the previous months added values Screenshot 2025-02-04 174751.pngScreenshot 2025-02-04 180003.png

3 REPLIES 3
bhanu_gautam
Super User
Super User

@pradeepnani Try using

VAR LastSDate = MAX('CALENDAR'[Date])
VAR Last3Months = DATESINPERIOD('CALENDAR'[Date], LastSDate, -3, MONTH)
VAR Last3MonthsSum = CALCULATE(SUM(Orders[Freight]), Last3Months)
VAR Month1 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], LastSDate, -1, MONTH))
VAR Month2 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -1), -1, MONTH))
VAR Month3 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -2), -1, MONTH))

RETURN IF(
ISBLANK(SELECTEDVALUE('CALENDAR'[MONTH_YEAR])),
0,
FORMAT(Last3MonthsSum, "#,##0") & " (" & FORMAT(Month1, "#,##0") & ") + (" & FORMAT(Month2, "#,##0") & ") + (" & FORMAT(Month3, "#,##0") & ")"
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






pradeepnani
New Member

sorry, for inconvenience here's the code 

**bleep** =
VAR LastSDate = MAX('CALENDAR'[Date])
VAR Last3MonthsSum = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], LastSDate, -3, MONTH))
VAR Month1 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], LastSDate, -1, MONTH))
VAR Month2 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -1), -1, MONTH))
VAR Month3 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -2), -1, MONTH))

RETURN IF(
    ISBLANK(SELECTEDVALUE('CALENDAR'[MONTH_YEAR])),
    0,
      Last3MonthsSum & " (" & Month1 & ") + (" & Month2 & ") + (" & Month3 & ")"
)
bhanu_gautam
Super User
Super User

@pradeepnani ,It would be better if instead of snap you share code with which we can work.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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