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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Isolate sum of previous month

hello, I use a measure that allows me to calculate an amount for the current month. Here it is below =>

Somme effectifs mois en cours ED PS = CALCULATE(SUM('ED Utilisation'[Table.Effectif Disponible]),LASTDATE('ED Utilisation'[Période]))

For clarification: The column "Periode" is a column in date format grouping the year, month and day.

 

I would now like to get this same calculation for the previous month of the current year. 

I tested with previous month and dateadd but it takes all my years. I can't isolate the previous month from the current year.

I need it because I want to calculate the difference between the current month and the previous month so I have to subtract the previous month measurement from the current month measurement.

 

Thank ! 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try to use date table

A= CALCULATE(SUM('ED Utilisation'[Table.Effectif Disponible]),LASTDATE('ED Utilisation'[Période]))

 

 

last month= CALCULATE([A],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

or

 

last month = CALCULATE(lastnonvalues(LASTDATE('ED Utilisation'[Période]),SUM('ED Utilisation'[Table.Effectif Disponible]) ) ,DATESMTD(dateadd('Date'[Date],-1,MONTH)))

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

2 REPLIES 2
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous 
Try this which I pulled from another example that I just completed. (Running total now has the previous month date in the pic)

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

 

 

VAR _curDate =
    //get the date of the current row
    MAX ( TableMine[Date] )
VAR _preDate =//HERE IS THE PREVIOUS DATE, 
    CALCULATE (
        MAX ( TableMine[Date] ),
        FILTER ( ALL ( TableMine ), TableMine[Date] < _curDate )
    )
VAR _calc =
    //Do the running total
    CALCULATE (
        [Sum of Hired],
        FILTER (
            ALL ( TableMine ),
            TableMine[Date] = _preDate))
               


predate.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Anonymous , Try to use date table

A= CALCULATE(SUM('ED Utilisation'[Table.Effectif Disponible]),LASTDATE('ED Utilisation'[Période]))

 

 

last month= CALCULATE([A],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

or

 

last month = CALCULATE(lastnonvalues(LASTDATE('ED Utilisation'[Période]),SUM('ED Utilisation'[Table.Effectif Disponible]) ) ,DATESMTD(dateadd('Date'[Date],-1,MONTH)))

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors