Tricky requirement in PivotTable: date problem in page field

mrchonginhk

Well-known Member
Joined
Dec 3, 2004
Messages
679
I have to report average DAILY sales of certain products in Pivot Table, and my boss has make a must requriement for me to put in the page field a button for him so that he can select the view as Jan, Feb, mar... and Dec and of course ALL for the year. He is always interest to see the DAILY average sales for a particular month or for whole year not the monthly total or annual total.

So the data I gathered are under this column:-

Product, date, sales value

My initial attempt was to create a calculated field to divide sales by 31 to give the daily average. This works ONLY when he select Jan or Feb or.. Dec in page view. If he selects ALL, it is annual total sales divided by 31 which is meaningless.

Also not all months are 31 days.

How to tackle this extremely tricky questions ? I have used Pviot Table for years and I still cannot figure this out.

Any expert here can help me from getting fired ? He keeps asking me why I cannot do this "Simple" thing .... help !!!!!!!!!!!!!

:pray:
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Re: Tricky requirement in PivotTable: date problem in page f

I tried to use average instead of sum but problem jumps out:-

My data has many items which has values under "Product" and "dates" but got zero values under "Sales Values". Using Average will give a very low number as it is distorted by these zero entries. I cannot delete these rows because the real data is bigger (eg it has "Value 2" column and many times "Sales Value" has zero value but Value 2 has value and I have to keep it as I need to analyse "Sales Value" and "Value 2" together as well).

Also the 28, 30, 31 days problem is killing me..

help pls !!!
 
Upvote 0
Something like this will allow you to work out the number of the days in the month (if that helps):

=DAY(DATE(YEAR(B11),MONTH(B11)+1,1)-1)
 
Upvote 0
Re: Tricky requirement in PivotTable: date problem in page f

Thanks.... how and where to incorporate your magic formular into the pivot table ? Calculated field or I have to put it in the data first ??
 
Upvote 0
Magic formula? I think not - others on this site would probably give you a shorter one. lol.

You could use a calculated field I guess, or just put it in the spreadsheet in a cell next to where the result is normally located.

Not my great area of expertise (as you can tell).
 
Upvote 0
Re: Tricky requirement in PivotTable: date problem in page f

I think the bottleneck is computing the average sales based on the total sum sales value divided by number of days within the item selected in the page field (ie if Jan is select, divide by 31, Feb divided by 29 and ALL divided by 365) instead of average based on number of entries in the data.

But really I have no idea as to how this can be done...


:rolleyes: :rolleyes: :rolleyes: :rolleyes:
 
Upvote 0
Re: Tricky requirement in PivotTable: date problem in page f

Another possible solution is exluding zero entries when pivot table does the average calculation... any chance for this route ?
 
Upvote 0
Re: Tricky requirement in PivotTable: date problem in page f

mrchonginhk,
Not sure if this helps. You can insert a new column and use this formula to get the month.
Code:
=TEXT(B2,"mmm")
If you are concerned about 0's one possible solution is to select your entire database and replace 0's with blank cells. Select the data then Ctrl + H, in "Find what" put in 0, in "Replace with" leave blank, check the box for "Find entire cells only" and select replace all. The pivot table will not calculate blank cells as part of the average equation.
Book3
FGHIJK
1Date2Jan
2
3AverageofSalesProduct
4DateABCDGrandTotal
51/14/2004185200560278361
61/15/2004101422337321
71/17/2004796628315580
81/18/2004511511
91/19/200430290203
101/21/2004616616
111/22/2004567159431
121/23/2004885712799
131/24/200441937912616357
141/25/2004333526450457
151/26/2004395395
161/27/2004632632
171/28/2004283123229
181/29/2004503748691437605
191/30/2004143281563329
201/31/2004207877542
21GrandTotal305544422489438
Sheet2
 
Upvote 0
Re: Tricky requirement in PivotTable: date problem in page f

This is the data layout:
Book3
ABCD
1ProductDateDate2Sales
2A1/25/2004Jan333
3D5/11/2004May817
4D1/25/2004Jan759
5C3/2/2004Mar991
6D1/24/2004Jan616
7A4/7/2004Apr
8C2/22/2004Feb63
9A2/28/2004Feb946
10A5/8/2004May165
11B3/6/2004Mar366
12D4/23/2004Apr259
13B2/12/2004Feb58
14C4/6/2004Apr761
15B1/31/2004Jan877
16A4/27/2004Apr654
17C5/10/2004May573
18D3/29/2004Mar
19A3/1/2004Mar444
20B4/11/2004Apr748
21B3/16/2004Mar495
22B4/13/2004Apr303
23B2/15/2004Feb387
24A3/3/2004Mar354
25D4/12/2004Apr797
26A4/16/2004Apr60
Sheet2
 
Upvote 0

Forum statistics

Threads
1,216,750
Messages
6,132,502
Members
449,730
Latest member
SeanHT

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