Results 1 to 1 of 1

Thread: PQ - Count sub-levels in Pivot Table

  1. #1
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool PQ - Count sub-levels in Pivot Table



    Code:
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Group = Table.Group(Table.SelectRows(Source, each ([Members] <> null)), {"Teams"}, {{"Car", each _, type table}, {"Count", each Table.RowCount(_), type number}}),
        Brackets = Table.TransformColumns(Table.TransformColumns(Group, {{"Count", each "(" & Text.From(_, "en-GB"), type text}}), {{"Count", each _ & ")", type text}}),
        Join = Table.CombineColumns(Brackets,{"Teams", "Count"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Count"),
        TSC = Table.SelectColumns(Table.ExpandTableColumn(Join, "Car", {"Members"}, {"Members"}),{"Count", "Members"})
    in
        TSC
    after M go to tab INSERT - Pivot Table, select use an external data source then select Query table, Open, choose the place for Pivot Table then OK

    source data:
    Teams Members
    Team Blue Felix Weiss
    Team Blue Maggy Z. Cruz
    Team Blue Melyssa Hale
    Team Blue Beau E. Colon
    Team Blue Brenden Roach
    Team Blue Ahmed U. Joyner
    Team Blue Signe Reilly
    Team Blue Candice G. Soto
    Team Blue Casey N. Rivas
    Team Blue Bevis Whitney
    Team Blue Ralph D. Andrews
    Team Blue Cherokee Anthony
    Team Blue Zachary Stout
    Team Blue Ora Hill
    Team Blue Buffy B. Rosa
    Team Red Blair Cooley
    Team Red Damian E. Saunders
    Team Red Daphne Z. Nguyen
    Team Red Rina Chaney
    Team Red Ivor Dudley
    Team Red Nolan E. Park
    Team Red Chastity Lewis
    Team Red Olivia K. Humphrey
    Team Red Ahmed F. Sherman
    Team Red Oscar Franklin
    Team Red Noah Flowers
    Team Red Quemby Bond
    Team Red Kadeem O. Colon
    Team Red Reuben O. Pacheco
    Team Red Sebastian B. Wynn
    Team Red Denton K. Cooke
    Team Red Bernard E. Barrett
    Team Red Victoria N. Pace
    Team Red Jesse Edwards
    Team Red Nita T. Lawrence
    Team Red Galvin Bird
    Team Red Allen Bright
    Team Red Bo Sweeney
    Team Red Casey Odom
    Team Red Whitney Vargas
    Team Red Laurel Ayala
    Team Red Francesca Huff
    Team Red Yoshi Mills
    Team Red Finn Fitzpatrick
    Team Red Zelda Weiss
    Team Red Keith Osborn
    Team Red Nell T. Cash
    Team Red Holly M. Gould
    Team Red Savannah W. Rosario
    Team Red Thomas Salas
    Team Red Joan Steele
    Team Red Hillary Y. Mann
    Team Red Melissa H. Ellis
    Team Red Bert Bradford
    Team Pink Hiram Myers
    Team Pink Mohammad Mcconnell
    Team Pink Tatiana Gallegos
    Team Pink Maxwell Y. Galloway
    Team Pink Blythe Schneider
    Team Pink Debra Patton
    Team Pink Wyoming D. Berg
    Team Pink Sade Dillard
    Team Pink Abraham Z. Pate
    Team Pink Renee Grant
    Team Pink Keegan K. Kelly
    Team Pink Kessie N. Hutchinson
    Team Pink Allistair Foley
    Team Pink Bo Knight
    Team Pink Claudia V. Grant
    Team Pink Shellie U. Joyce
    Team Pink Rhiannon V. Hardin
    Team Pink Tanek T. Conley
    Team Pink Reed J. Dunlap
    Team Pink Cody Molina
    Team Pink Caleb J. Powers
    Team Pink Alea Mayo
    Team Pink Iona D. Knight
    Team Pink Oleg X. Farrell
    Team Green Claire N. Wyatt
    Team Green Alan H. Good
    Team Green Orson Gould
    Team Green Yoshi Vincent
    Team Green Ciaran Brady
    Team Green Timothy Scott
    Team Green Portia Y. Franco
    Team Green Marvin W. Norman
    Team Black Owen K. Charles
    Team Black Garrison X. Burke
    Team Black Tasha Bridges
    Team Black Fallon Q. Ferguson
    Team Black Jermaine Cochran
    Team Black Yolanda Hernandez
    Team Black Bradley B. Olson
    Team Black Garrison Q. Clements
    Team Black Maxine D. Talley
    Team Black Colt Galloway
    Team Black Lawrence Robertson
    Team Black Rashad Witt
    Team Black Harding B. Leonard
    Team Black Chanda Dudley
    Attached Images Attached Images
    Last edited by sandy666; 07-29-2020 at 07:00 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

Similar Threads

  1. Replies: 1
    Last Post: 03-08-2016, 06:30 PM
  2. Use SUMIFS on pivot table data
    By malta1 in forum Excel Help
    Replies: 1
    Last Post: 02-18-2014, 10:55 AM
  3. Create a Pivot table
    By NITIN SHETTY in forum Excel Help
    Replies: 3
    Last Post: 01-26-2013, 11:01 AM
  4. Lookup and Count Using Pivot Table
    By RobExcel in forum Excel Help
    Replies: 2
    Last Post: 12-21-2012, 11:08 AM
  5. Pivot Table Count No of Items per Category
    By Howardc in forum Excel Help
    Replies: 2
    Last Post: 07-04-2012, 10:49 PM

Posting Permissions

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