Sum of Distinct Month Days

Waqas1234

New Member
Joined
Jul 9, 2013
Messages
3
Parent Account Product Nature Month Period Days Year Values
1 101 A Brown Jan 2015 1 31 2015 50
1 101 B Brown Jan 2015 1 31 2015 90
1 102 A Brown Jan 2015 1 31 2015 20
1 102 B Black Feb 2015 2 28 2015 10
2 101 A Black Feb 2015 2 28 2015 30
2 101 B Black Mar 2015 3 31 2015 40


How to Sum the No of days only once Upon each month change. I have tried using distinct formula SUMX(DISTINCT(RSF[Month]),SUM(RSF[Days])). I want to use this result further into some other calculation and expected result should be March 31 days + Feb 28 days+ Jan 31 Days = Total 90 days but I am getting instead my numbers in more than 1000 no of days. Thanks in advance.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi Waqas1234,

After pasting your data in Excel, I am getting following view:-

[TABLE="width: 780"]
<colgroup><col span="10"></colgroup><tbody>[TR]
[TD]Parent[/TD]
[TD]Account[/TD]
[TD]Product[/TD]
[TD]Nature[/TD]
[TD]Month[/TD]
[TD]Period[/TD]
[TD]Days[/TD]
[TD]Year[/TD]
[TD]Values[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]101[/TD]
[TD]A[/TD]
[TD]Brown[/TD]
[TD]Jan[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]101[/TD]
[TD]B[/TD]
[TD]Brown[/TD]
[TD]Jan[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]90[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]102[/TD]
[TD]A[/TD]
[TD]Brown[/TD]
[TD]Jan[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]102[/TD]
[TD]B[/TD]
[TD]Black[/TD]
[TD]Feb[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]101[/TD]
[TD]A[/TD]
[TD]Black[/TD]
[TD]Feb[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]30[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]101[/TD]
[TD]B[/TD]
[TD]Black[/TD]
[TD]Mar[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]31[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]40[/TD]
[/TR]
</tbody>[/TABLE]

Now where you need this results based on what cell reference, can you give an example ?

Regards,
DILIPandey
 
Upvote 0
Hi

Thanks for reply

Month column is 01/01/2015 which in formatting I have changed to look like Jan 2015 and in below I think its separated when posted to excel again.

I need a formula which can give me per day revenue. To sum values its simple but sum formula can not be applied on days otherwise for each transaction date it will sum the total month days which will be wrong. I want only Jan days to come only once in denominator.

for example Jan sales = 160 (50+90+20) which should be divided by only 31 days of January and not by the sum of all 31's in the column. I am using this in another formula in pivot where I will have years at left and months at Top


1 2 3 4 5 6 7 8 9 10 11 12
2014
2015



Regards
Waqas
 
Upvote 0
You really want to have a separate Calendar table. Then it just becomes Sales Per Day :=SUM(Sales[Values]) / COUNTROWS(Calendar)
 
Upvote 0
@scottsen

How do you link said calendar table with RSF? What would be the best procedure?
 
Upvote 0
In your Days column use this formula:
=IF(COUNTIF($E$1:E2,E2)=1,DAY(EOMONTH(E2,0)),0)

Then you can still sum your days but it will add 0 if the count of the month is more than 1.
 
Upvote 0
Sorry for the slow reply :)

So, typically I try pretty hard to have a "real" Calendar table, which means it has a row for every day. Then you have lots of helper columns (year, month, Year Month, etc). It does mean that your fact data needs to be at the day level, and when pre-aggregated to some other level (month), ... you can usually get away with faking the date (Pretend Jan 2015 is Jan 1, 2015).

In your case, I would probably do that, and add a "Days in Month" column to my Calendar table.
 
Upvote 0

Forum statistics

Threads
1,224,118
Messages
6,176,483
Members
452,730
Latest member
palsmith

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