Distinct Count in a pivot table IF greater than a specific value

dayday123

New Member
Joined
Mar 12, 2014
Messages
24
Hello All -

using the data model i can easily use the distinct count but I am looking for a way to not only do a distinct count but a distinct count when a certain other value is met. For example based on the below table:

If i were to pivot the data and do a count of "Product" it would show 5
If I did a distinct count of "Product" it would show 3
How can I do a distinct count of "Product" only when the total quantity exceeds 100 - which should be a count of 2

Is there any way to do this in a pivot table?

Thanks so much in advance!

ProductMonthQuantity
Product 1Jan105
Product 2Jan90
Product 2Feb20
Product 3Jan50
Product 3Feb30
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
so simple question: which one is your final result?
3 and 4 would both be final results depending on whether the month dimension is added. I included both to show that in either scenario i want the filter to be on quantity but the result would vary depending on what dimensions are included. The same way uniquecount works. But now with an additional filter. Is that clear?
 
Upvote 0
add to data model
add field Quantity as the first position in ROWS area, add field Product to the ROWS area and add field Product to the Value area for distinct count
then Quantity value filter greater then 100
right click on Pivot and remove Product
pt1.png
 
Upvote 0
add to data model
add field Quantity as the first position in ROWS area, add field Product to the ROWS area and add field Product to the Value area for distinct count
then Quantity value filter greater then 100
right click on Pivot and remove Product
View attachment 6707

When i try to do a value filter on quantity the only options it gives me are distinct count of product and count of product. There is no option to actually filter on the quantity since it is in ROWs and therefore not a value?
 

Attachments

  • value filter on quantity.png
    value filter on quantity.png
    94.5 KB · Views: 11
Upvote 0

yes i tried that (from the quantity row) but in my screen shot i shared once I select "greater than" it pops up a second screen where I need to choose what value i want to filter and the only 2 options are 1)count of product or 2)distinct count of product. I attached the two screens I see. It won't allow me to filter on quantity.
 

Attachments

  • Capture.PNG
    Capture.PNG
    103.1 KB · Views: 11
Upvote 0
  1. Add Quantity to the ROWS area
  2. Add Quantity to the VALUES area
  3. Filter first (ROWS) Quantity greater than 100
  4. change second (VALUES) Quantity to Distinct Count
 
Upvote 0
Image 3 you will need to DAX it our build the basic Pivot Table and then use a GETPIVOTDATA function.
Capture.PNG
 
Upvote 0
without Pivot but with Power Query
QuantityCount
1051
Total1
QuantityCount
1051
1101
Total2

or
ProductQuantityCount
Product 11051
Total1
ProductQuantityCount
Product 11051
Product 21101
Total2
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,935
Messages
6,175,493
Members
452,649
Latest member
mr_bhavesh

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