Previous month sales

illusionek

Board Regular
Joined
Jun 21, 2014
Messages
104
Hello

I have a calendar and sales tables in a format similar to below, they are connected via Year-Period column.

I am trying to calculate previous month sales and below formula is working but only if I put Period No in my table, what I would like to happen is for that measure to work in all scenarios whether I display data by Period No, Month No or Year-Period.


So far the only way I can make it work is if I amend filter part of my measure to Month No, Year-Period etc.

So I am now not sure if I need three sperate measures for each scenario or the issue is with the way I created the measure in the first place.


Excel Formula:
PreviousMonthSales = Calculate([ActualSales], Calendar[Period No] = Min(Calendar[Period No])-1)

Period NoActual SalesPrevious Month Sales
2​
322​
0​
3​
68​
322​
Month NoActual SalesPrevious Month Sales
6​
322​
0​
7​
68​
322​
Year-PeriodActual SalesPrevious Month Sales
2023-2
322​
0​
2023-3
68​
322​

Calendar table

DateMonth NoPeriod NoYearYear-PeriodStart DateEnd Date
21/06/2023​
6​
2​
2023​
2023-2
01/06/2023​
30/06/2023​
17/07/2023​
7​
3​
2023​
2023-3
01/07/2023​
31/07/2023​


Sales Table

ProductYear-PeriodActual Sales
A2023-2
100​
B2023-3
2​
C2023-2
222​
A2023-3
66​
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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