cancel
Showing results for
Did you mean:
New Member

## Calculation for Last month Same Period

Hi All,

I am trying to calculate a measure for last month same period i.e. if today is 7.2.2019, I want to calculate sum(sales) for last month up to the 2nd day i.e. 6/2/2019. I have researched this and found a formula on most of the posts that I am trying to use but it doesn't give me the correct value.

Any help will be appreciated, thanks in advance!

Formula: Last MTD Sales=
CALCULATE(
Sum('Main'[Sales]),
DATEADD( DATESMTD( Dates[Date] ), -1, MONTH )

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV

## Re: Calculation for Last month Same Period

Hi,

Ensure that there is a relationship between the Date column of the Main Table to the Date column of the Calendar Table.  Drag the Date column from the Calednar Table to your slicer/visual and select today's date in the slicer/filter.  Write this measure

Last MTD Sales = CALCULATE(Sum('Main'[Sales]),DATESBETWEEN(Dates[Date],EOMONTH(MIN(Dates[Date]),-2)+1,EDATE(MIN(Dates[Date]),-1))

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
3 REPLIES 3

## Re: Calculation for Last month Same Period

Try this

Formula: Last MTD Sales=
CALCULATE(
Totalmtd(dates[date],Sum('Main'[Sales]),

* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Highlighted
Super User III

## Re: Calculation for Last month Same Period

Hi @AJthacker ,

The syntax of the measure seems ok but without any additional information is difficult to understand what you need and what is the final result you are looking for.

Can you share a sample data and expected result?

Regards,

MFelix

Regards

Miguel Félix

Proud to be a Datanaut!

Check out my blog: Power BI em Português

Super User IV

## Re: Calculation for Last month Same Period

Hi,

Ensure that there is a relationship between the Date column of the Main Table to the Date column of the Calendar Table.  Drag the Date column from the Calednar Table to your slicer/visual and select today's date in the slicer/filter.  Write this measure

Last MTD Sales = CALCULATE(Sum('Main'[Sales]),DATESBETWEEN(Dates[Date],EOMONTH(MIN(Dates[Date]),-2)+1,EDATE(MIN(Dates[Date]),-1))

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors