+ Reply to Thread
Results 1 to 10 of 10

PIVOT TABLE - get the distinct values not count

  1. #1
    Registered User
    Join Date
    12-02-2014
    Location
    France
    MS-Off Ver
    2013
    Posts
    11

    PIVOT TABLE - get the distinct values not count

    Hello
    I need help with an issue i have and i can't figure how to do it with Pivot Table (or other way if easier).
    I have a list of sales done for different products(product id, quantity, sold price, tota price, ) and i want to do a summery of all prudcts based on price sold, quantity at price sold and sum.
    When i try to use Pivot i can't get this type of view because the same product could be sold and different prices. Pivto either gives me the avare of price sold or the sum but doesnt group the products by quantity sold at a price.

    Here it is how my data looks like:

    Product ID Quantity (units) Unit Price(euro) Total Sales (euro)
    Product A 5 7 35
    Product A 10 4 40
    Product A 6 8 48
    Product A 5 4 20
    Product A 2 7 14
    Product A 50 4 200
    Product B 3 10 30
    Product B 10 20 200
    Product B 4 10 40
    Product B 5 11 55
    Product B 2 10 20
    Product B 50 10 500


    And i want to create the following type of summery table

    Product ID Quantity (units) Unit Price(euro) Total Sales (euro)

    Product A 7 7 49
    Product A 65 4 260
    Product A 6 8 48

    Product B 59 10 590
    Product B 10 20 200 .
    Product B 5 11 55


    Is there a way to do this with a pivot table or other easy way that doesnt take a lot of manual work since i have data list of 200k lines and many different price variations

    Thank you in advance for your help.

    Best Regards
    R

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: PIVOT TABLE - get the distinct values not count

    It looks like you just need to put the unit price into the row field area instead of the values area.
    Rory

  3. #3
    Registered User
    Join Date
    12-02-2014
    Location
    France
    MS-Off Ver
    2013
    Posts
    11

    Re: PIVOT TABLE - get the distinct values not count

    YEs i Tried this but when i do this for some reason it does not group quantities it just shows them again.
    I mean it groups some and some other not. i dont know why it does that . i have tried everything but same result.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: PIVOT TABLE - get the distinct values not count

    You'll need to post a workbook then. There is no reason that would happen if the values are actually the same.

  5. #5
    Registered User
    Join Date
    12-02-2014
    Location
    France
    MS-Off Ver
    2013
    Posts
    11

    Re: PIVOT TABLE - get the distinct values not count

    I have attached a sample of one of the cases.

    As i said before for some cases id does the grouping by the price unit as supposed for some cases like the one in attached file it does not group it

    Thank you again for the help
    Attached Files Attached Files

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: PIVOT TABLE - get the distinct values not count

    That is very strange. I can see the problem in your sample, but simply refreshing the pivot table makes it disappear for me!

  7. #7
    Registered User
    Join Date
    12-02-2014
    Location
    France
    MS-Off Ver
    2013
    Posts
    11

    Re: PIVOT TABLE - get the distinct values not count

    Thas weird. I try refresh but does'nt work for me.*
    I have checked the cell format and everything but still same issue. Cant figure out why it does that.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: PIVOT TABLE - get the distinct values not count

    Have you tried changing the format on the source column then refresh the pivot table?

  9. #9
    Registered User
    Join Date
    12-02-2014
    Location
    France
    MS-Off Ver
    2013
    Posts
    11

    Re: PIVOT TABLE - get the distinct values not count

    Actualy a just tried dobule click (to go in edit mode ) on data sheet on the cells which do not group together and than when i do refresh it recognizes them as same value.
    I mean a created another column of unit price with the copy - paste values as values not formula then i double clicled the cell that do not group and made a refresh on the pivot and know it recognizes them as same values.

    My problem is that i have thousand of rows and values and can not do this manually for all. Do you know somethin i can do that might solve this issue ?

    Thank you

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: PIVOT TABLE - get the distinct values not count

    Your pivot table is based on data model.
    See in PivotTable Analyze -> "Change Data Source" -> Connection Properties.

    However, column data types (i.e. field properties) are not defined in the model.

    To identify the underlying issue, select any cell in your pivot table. On PivotTable Analyze ribbon, go to "Calculations" section and click on OLAP tools -> Convert to formula.

    Now check "P.Unit" field of converted formula.

    For first P.Unit 4.9 It's defined as...
    Please Login or Register  to view this content.
    But for the second P.Unit 4.9 It's defined as...
    Please Login or Register  to view this content.
    So the item name is different between the two and not considered duplicate.

    Best way to deal with this is... Instead of loading directly to Data Model from range, load to PowerQuery (Get & Transform) and define column data types.

    For all columns that should be added to row label field, they should be defined as "Text". Any floating point error should be dealt in the query editor as well.

    Then, when you are satisfied, load from query into data model.

    EDIT: Alternately, if you don't need data model (i.e. you are not using DAX measures in your Pivot Table). You can simply recreate the pivot table without adding data to the model.
    Make sure that you don't select "Add this data to the Data Model" option when you create the pivot table.
    0.JPG
    Last edited by CK76; 07-09-2020 at 09:28 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Pivot Table Distinct Count
    By matth3881 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-02-2022, 01:02 AM
  2. [SOLVED] Count distinct value and SUM in the same Pivot table
    By Faridwahidi in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 03-15-2019, 11:35 AM
  3. Help with distinct count on Pivot table
    By Jonathan11235 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-27-2016, 07:25 AM
  4. How to count distinct values from table in pivot table
    By gopijadhav in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-04-2014, 07:14 AM
  5. How do I set up Distinct Count in a Pivot Table?
    By STOFF in forum Excel General
    Replies: 1
    Last Post: 04-18-2006, 01:25 PM
  6. [SOLVED] count distinct in Pivot table
    By soe in forum Excel General
    Replies: 1
    Last Post: 02-22-2005, 10:06 AM
  7. [SOLVED] Count Distinct Values by Group Using Pivot Table (NM)
    By MCP in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2005, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1