+ Reply to Thread
Results 1 to 3 of 3

counting the total, grouped by a specific field

  1. #1
    Registered User
    Join Date
    11-25-2011
    Location
    Kortrijk, Belgium
    MS-Off Ver
    Excel 2003
    Posts
    3

    counting the total, grouped by a specific field

    Hello,

    I've got a table with the following columns:
    FirJrPer: which shows what company, year and month the data is about (text).
    Car: the licenceplate of the specific car
    Departement: text
    Nrcars: indicates how much that car was used by that departement (0-1).
    Totalcost: total cost of the cars for that specific period and company.

    My problem: I want a calculated column, which gives me, for each row (=car), the sum of Nrcars for the rows in the table where FirJrPer is the same.
    I've tried it with:
    =sumx(filter('Cars',Cars[FirJrper]=Cars[FirJrper]),Cars[Nrcars]),
    hoping that the filter-expression would give the selection I want, but it gives me the whole table. If I replace it with a specific example, e.g. =sumx(filter('Cars',Cars[FirJrper]="LNU20111",Cars[Nrcars]), then I get the correct result. So, I want the same thing, but with "LNU20111" being what is in the FirJrper-field of the particular row.

    Hope someone can help.

    Steven

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: counting the total, grouped by a specific field

    Hi Steven,

    Probably a Pivot Table?
    Any chance you could upload the workbook - anonymised if necessary with a few notes referring to your data and examples of the results you expect.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-25-2011
    Location
    Kortrijk, Belgium
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: counting the total, grouped by a specific field

    Hello Richard,

    I've enclosed a screenshot. Maybe that'll make it more clear.

    I want the calculated column, where you see 16 everywhere, (which is the total for LNUYT20111), to give the total, grouped by FirJrPer.
    Right now, I'm finding a solution by making first a pivot that gives the number I want, and then import it in powerpivot, link with it, ...
    But it seems to me there should be an easier way.

    Steven
    Attached Images Attached Images

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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