Filtering Powerpivot

CLExcel

New Member
Joined
Jan 22, 2015
Messages
3
I am trying to filter a pivot table to display the very first record within a field. I am trying to get the first invoice number for a customer. As of now, I am getting multiple records, and have been unable to set some sort of filter to only get the first invoice. My data is organized in a tabular format, and the invoice number is a field in my main fact table.

In the chart below, for example, I would only want to see one InvoiceNumber for each STORE A, STORE B, and STORE C; it would be the oldest InvoiceNumber for the customer (so, it would be the first invoice for the customer).

Any thoughts on how to filter this data to get this result?

Customer Name (No.)
Sales Rep Name


InvoiceNumber


First Sale Date


OrderNumber


CustomerPO


Invoice Date


STORE A
TH123451/1/130001121/3/13
STORE ATH234561/1/130002231/29/13
STORE BLK345672/7/140003342/8/14
STORE BLK456782/7/140004452/22/14
STORE BLK567892/7/140005562/28/14
STORE CRS678903/8/140006673/9/14
STORE CRS789013/8/140007783/15/14

<tbody>
</tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi CLExcel....since this is in the Power Pivot forum, assuming you have the sales table in your model.

The easiest way to accomplish this is a calculated column on the sales table to flag the first invoice. The calculation below shows the first invoice for the custom across all dates. If you wanted it to be based on other static filters or selected filters, you would have to add other logic to the calculation (i.e. if within a particular year you would add a related(date[year]) entry to the ALLEXCEPT portion, or if you wanted it to be the first invoice within the other selected filters, you would utilize ALLSELECTED logic)

1. Added [First Customer Invoice] flag (TRUE/FALSE) on the Sales table:
=IF( [InvoiceNumber] = CALCULATE( MIN( Sales[InvoiceNumber]), ALLEXCEPT( Sales, Sales[Customer Name (No.)]) ), 1, 0 )
2. Added that as a slicer on the pivot table

PowerDAX.com
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,970
Members
448,933
Latest member
Bluedbw

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