Previousmonth AND Dateadd

jon999

New Member
Joined
Aug 24, 2015
Messages
37
Hi

I am trying to working out the last month and used Calculate([measure],previousmonth(calendar[date]) and I get the list from July to December but don't get any numbers from January to June. I am using a financial year end date 30 June. When I use Dateadd I get an error message about only works with contiguous date selection when I do have a list of dates.

How do I get it so it will pick up the financial year (1 July - 30 June) and not a calendar year.

Thanks

Jon
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Previousmonth takes the first date in the current filter context, then returns the previous entire month. It makes no difference if it is a fin year or not - previous month is previous month.

What do you mean you "get the list"?

I would use calculate([measure],dateadd(cal[date],-1,month))
 
Upvote 0
Hi Matt

As always thanks for the reply.

What I meant by get the list was I have a calendar table which has each individual dates for 2 years.

When I use the dateadd formula you mentioned I can an error message:

MdxScript(Model) (6,62) Calculation error in measure 'Data[Measure 1]: Function 'DATEADD' only works with contiguous date selections.

Thanks

Jon
 
Upvote 0
Yes, many time intelligence functions need contiguous date ranges. If you put months on rows in a pivot, but don't put a filter on year, then Jan will return Jan for multiple years. So you must have a filter on year as well as something below that - no greater than month in your case.

Put year on rows, then put month on rows too, then the measure on values
 
Upvote 0

Forum statistics

Threads
1,214,625
Messages
6,120,598
Members
448,973
Latest member
ksonnia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top