Counting number of invoices in a sales report

LBala

New Member
Joined
Apr 3, 2014
Messages
22
Hi all;

I have a sales report and I need to count the number of invoices showing:
- Less than 1 piece being sold
- Only 1 piece being sold
- 2 pieces being sold
- 3 pieces being sold
- More than 3 pieces being sold

I am trying to get those results being able to filter:
- By state
- By period (year, month and week day)
- By department

Here is a picture of the diagram view:

nv732u.jpg


Here is a picture of the pivot table with the filters and results:

mh7s0i.jpg


In the picture above, for the filters applied I have a total of 6 invoices:
- 5 invoices showing only 1 piece sold (invoices 3931, 3932, 3933, 3942 and 3943, "QTY_Sold" = 1)
- 1 invoice showing 5 pieces sold (invoice number 3937, 3 items listed, "QTY_Sold" = 2 + 2 + 1)

I would like to get the results as shown in the formats A and B below:

Format A) By number of invoices:

2aa0hao.jpg



Format B) By number of invoices as a percentage from the total:

2hq9lrl.jpg



I have uploaded the excel file I am working with on to dropbox for easy download (file size: 343 KB):
https://www.dropbox.com/s/0fq6ieepz16sny4/Report_Sample.xlsx?dl=0

I can't figure out a way to show the results as in the pictures above.
Any help or suggestions will be appreciated.
Thanks.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
The pattern you need is this

Code:
=CALCULATE(
     DISTINCTCOUNT(Invoices[Invoice_Num]),
     FILTER(
          values(Invoices[Invoice_Num]),
          CALCULATE(sum(Invoices[QTY_Sold]))=1
     )
)

Just change the =1 to be what ever you need.
 
Upvote 0
Matt, that is exactly what I needed! It works perfectly.


ImkeF, thanks for the article about bucketing, that’s interesting.


Thank you guys.
 
Upvote 0

Forum statistics

Threads
1,224,157
Messages
6,176,744
Members
452,741
Latest member
Muhammad Nasir Mahmood

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