Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
userid128223
Creator
Creator

Grouping Dimension & Expression in pivot

I have following pivot table: (just for example)

CountyCityPopulation (expression)
USNY5
Florida40
Boston2
LA1
Phoenix2
CanadaToronto35
Kingston2
Calgary1
Vancouver2

Dimensions = Country & City

Expression = population.

Now i want to group some City dimension together and similarly group their expression as well how do i accomplish that.

Results:

CountyCityPopulation (expression)
USNY, Boston7
LA, Phoenix3
Florida50
CanadaToronto, Kingston37
Calgary1
Vancouver2
1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Extending Robin's expression: add City in your aggregation. 

BTW how you got 50 for City Florida, was it a typo or were you adding total to your city Florida?

Like  below.

Dim:

= Country

= aggr(if(match(City,'NY','Boston'),'NY, Boston',

       if(match(City,'LA','Phoenix'),'LA, Phoenix',

          if(match(City,'Toronto','Kingston'), 'Toronto, Kingston',

               City))), Country, City )

View solution in original post

7 Replies
Anonymous
Not applicable

calculated dimension:

aggr(if(match(City,'NY','Bostom),'NY, Boston',

     if(match(City,'LA','Phoenix'),'LA, Phoenix',

          if(match(City,'Toronto','Kingston'),'Toronto, Kingston',

               City))),County)

vishsaggi
Champion III
Champion III

Extending Robin's expression: add City in your aggregation. 

BTW how you got 50 for City Florida, was it a typo or were you adding total to your city Florida?

Like  below.

Dim:

= Country

= aggr(if(match(City,'NY','Boston'),'NY, Boston',

       if(match(City,'LA','Phoenix'),'LA, Phoenix',

          if(match(City,'Toronto','Kingston'), 'Toronto, Kingston',

               City))), Country, City )

userid128223
Creator
Creator
Author

What will be the expression to match the dimension.

Anonymous
Not applicable

???

userid128223
Creator
Creator
Author

so how would you group the population based on grouping criteria.

vishsaggi
Champion III
Champion III

The aggr() function used above is grouped by Country. So it would automatically look for matching based on Country grouping.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The Dimension takes care of the grouping. The expression remains the same:

  sum(Population)

-Rob