cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dinovic
Frequent Visitor

Lastdate current month. Compare revenue to corresponding date last month.

I have a measure of Revenue for the current month. The revenue is cumulative, hence the last day revenue is my MTD calculation.

In order to be able to perform month to month comparison I would need to find the corresponding "last date" from previous month. I.e. if the lastday measure below return 11th of April, I would like the previous month measure to return 11th of March. Tried with parrarelperiod function but without any results. 

All help appreciated,

thanks.

 

lastday = LASTDATE('sales'[dateCreated])

Revenue Current Month = CALCULATE(SUM('sales'[revenue]) , DATESBETWEEN('sales'[dateCreated].[Date],[lastday],[lastday]))

Revenue Previous Month = ?

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft
Microsoft

Hi @dinovic,

 

According to your description above, you should be able to use Could you try the formula below to see if it works in your scenario?

 

Revenue Previous Month =
CALCULATE (
    [Revenue Current Month],
    DATEADD ( 'sales'[dateCreated], -1, MONTH )
)

In addition, based on my understanding, the DATEBETWEEN function is not necessary here in your [Revenue Current Month] measure, the formula below should also works. Smiley Happy

 

Revenue Current Month = CALCULATE ( SUM ( 'sales'[revenue] ), 'sales'[dateCreated] = [lastday] )

 

Regards

View solution in original post

1 REPLY 1
v-ljerr-msft
Microsoft
Microsoft

Hi @dinovic,

 

According to your description above, you should be able to use Could you try the formula below to see if it works in your scenario?

 

Revenue Previous Month =
CALCULATE (
    [Revenue Current Month],
    DATEADD ( 'sales'[dateCreated], -1, MONTH )
)

In addition, based on my understanding, the DATEBETWEEN function is not necessary here in your [Revenue Current Month] measure, the formula below should also works. Smiley Happy

 

Revenue Current Month = CALCULATE ( SUM ( 'sales'[revenue] ), 'sales'[dateCreated] = [lastday] )

 

Regards

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors