cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Compare against last year selected month

Hi, 

 

I need the follow formula as a measure : 

 

( Current Month / Last Year December ) - 1 = Result 

 

The idea is I can compare i.e. the data for march 2001 vs december 2000, or september 2005 vs december 2004. Every Month I select vs its last year december. All in the same table.  How can I do that? 

 

Thanks for your help. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Compare against last year selected month

Hi,

 

Try this

 

=(SUM(Data[Amount])/CALCULATE(SUM(Data[Amount]),DATESBETWEEN(Calendar[Date],DATE(YEAR(MIN(Calendar[Date]))-1,12,1),DATE(YEAR(MIN(Calendar[Date]))-1,12,31))-1

 

There must be a calendar table.  There should be a relatiosnhip from the Date column of the Data Table to the Date column of the Calendar Table.  In the Calendar Table, write these calculated column formulas to extract Year and month.

 

=YEAR(Calendar[Date])

=FORMAT(Calendar[Date],"MMMM")

 

In the visual you create, drag Year and Month in the Filter/slicer and select any one Year/Month.


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

View solution in original post

4 REPLIES 4
Rfranca Member
Member

Re: Compare against last year selected month

hi michael

You can calculate the averages using CALCULATE () with FILTER and the DATAADD function.
I think that will do.

 

DATAADD( )

https://msdn.microsoft.com/en-us/library/ee634905.aspx

 

ex...

Contains :=

 calculate(

     Sum([value]),

     Filter(

         All('Date'[date]),

         Contains(

            values('Date'[date]),

            'Date'[date], date(year('Date'[]date)), month('Date'[date])-1, day('Date'[date])

                  )

            )

       )

Highlighted
Super User IV
Super User IV

Re: Compare against last year selected month

Hi,

 

Try this

 

=(SUM(Data[Amount])/CALCULATE(SUM(Data[Amount]),DATESBETWEEN(Calendar[Date],DATE(YEAR(MIN(Calendar[Date]))-1,12,1),DATE(YEAR(MIN(Calendar[Date]))-1,12,31))-1

 

There must be a calendar table.  There should be a relatiosnhip from the Date column of the Data Table to the Date column of the Calendar Table.  In the Calendar Table, write these calculated column formulas to extract Year and month.

 

=YEAR(Calendar[Date])

=FORMAT(Calendar[Date],"MMMM")

 

In the visual you create, drag Year and Month in the Filter/slicer and select any one Year/Month.


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

View solution in original post

Re: Compare against last year selected month

Hi @Ashish_Mathur,

That's exactly what Im looking for. Thank you very much. Happy new year.

Super User IV
Super User IV

Re: Compare against last year selected month

Hi,

 

Happy New Year to you as well.  You are welcome.


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

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors