Unable to group ages, is that Power Pivot specific?

INN

Board Regular
Joined
Feb 3, 2021
Messages
118
Office Version
  1. 365
Platform
  1. Windows
Hi
In normal Pivot Table, I can group ages but with Power Pivot it is giving me an error message, please see screenshot + the link for the original file. Thank you.

1669141673516.png




11111.xlsx
ABCDEFGHIJKL
1Employee IDLocationPhone#SalaryIDNameGenderDepartmentAge
2413New Jersey1-227-803-387149633757Adina DaviesFemaleHuman Resources53
3749Idaho2-240-511-373335617269Chadwick VealeMaleManagement41
4756California1-063-681-274399276560Taylor ParkerFemaleMarketing40
5362Arizona4-375-511-306040240616Cadence RiversFemaleManagement61
6253Virginia3-001-423-675668880866Dakota IngramFemaleSales40
7169Nebraska5-744-575-0520101133383Britney BaileyFemaleAccounting53
8897Maryland3-211-804-864362656642Nathan MooreMaleHuman Resources49
9283Connecticut0-816-613-180291253253Aiden PrestonMaleSales29
10383Oregon2-646-560-582261551607Alexander RobertsonMaleIT60
11962Oklahoma6-430-606-800149507749Benny WilcoxMaleSales23
12642Rhode Island1-500-456-656737125554Tom ShieldsMaleR&D29
13866Utah3-624-321-7715105987648Denis WellingtonMaleIT56
14758Alaska4-471-266-574225206283Macy DobsonFemaleFinance38
15896Arizona3-484-738-163145881756Jack WellingtonMaleManagement57
16564Wyoming1-600-105-846750467852Tess CampbellFemaleMarketing38
17927Delaware8-363-618-852415675312Michaela OversonFemaleSales42
18543Tennessee1-251-243-425090102897Mavis MurphyFemaleOperations23
19269Colorado3-426-351-146029005962Bryon RichardsonMaleSales46
20108New Mexico7-211-682-744796952927Lillian MillsFemaleR&D40
21560Wyoming6-827-664-066295289896Barry CollingwoodMaleIT33
22757Wyoming5-114-658-780253650169Kurt JuddMaleIT34
23552Michigan7-445-055-081094688510Josh GriffithsMaleOperations26
24312Alaska1-705-832-876232521758Tom StantonMaleIT58
25607Ohio0-065-554-373839910543Angelique KnightFemaleOperations48
26616Colorado6-238-711-527344085552Elle TownendFemaleManagement63
27852Connecticut4-202-514-118276411564Johnathan McgeeMaleFinance27
28510West Virginia1-820-274-836167950413Juliet BristowFemaleManagement51
29554Oklahoma8-533-107-662889335108Mina RobertsFemaleSales51
30648Arkansas1-888-244-224393806362Jacqueline ReynoldsFemaleMarketing61
HR_1
 

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
If this is what you are looking for, then it can be done in Power Query.
1. Load each table to the PQ Editor
2. Join the two tables on the EE ID
3. Group the two tables on Age and Sum the results

Table2.AgeTotal
2398273
2667950
2750467
29158215
3345881
34101133
38167664
40216951
4129005
4232521
4649507
4890102
4937125
51146585
53115201
5693806
5799276
5825206
6039910
6184325
6394688


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Salary", Currency.Type}})
in
    #"Changed Type"

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Age", Int64.Type}})
in
    #"Changed Type"
Power Query:
let
    Source = Table.NestedJoin(Table1, {"Employee ID"}, Table2, {"ID"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Name", "Gender", "Department", "Age"}, {"Table2.Name", "Table2.Gender", "Table2.Department", "Table2.Age"}),
    #"Grouped Rows" = Table.Group(#"Expanded Table2", {"Table2.Age"}, {{"Data", each _, type table [Employee ID=number, Location=text, #"Phone#"=text, Salary=nullable number, Table2.Name=text, Table2.Gender=text, Table2.Department=text, Table2.Age=nullable number]}, {"Total", each List.Sum([Salary]), type nullable number}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Data"}),
    #"Sorted Rows" = Table.Sort(#"Removed Columns",{{"Table2.Age", Order.Ascending}})
in
    #"Sorted Rows"
 
Upvote 0
I then attempted to merge the two tables in Power Pivot and Group by the Age. No issue. Did you join the two IDs in the Power Pivot Data Model. It is in the relationship section. Same results as in your Excel Pivot Table and my Power Query Solution.
 

Attachments

  • Screenshot 2022-11-22 121745.jpg
    Screenshot 2022-11-22 121745.jpg
    59 KB · Views: 6
Upvote 0
Thanks for your reply. Yes I created relationship and everything is working fine except that I can not group age!
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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