Need to Group Categories in a dimension

domtrump

Board Regular
Joined
Apr 1, 2010
Messages
245
I am stumped goggling this one. It sounds so simple (and it used to be with a standard pivot table), but I cannot figure out how to group items in a dimension so that I can add them together as one unit.

Let's say I have a column called "Pets". The possible values for Pets are: Collie, Great Dane, Poodle, Tabby, Siamese, Persian. In my Pivot Table, I want to see "Dogs" (the sum of Collie, Great Dane, Poodle) and Cats (the sum of Tabby, Siamese, Persian). I used to just create a calculated ITEM that added each category together. I know that is no longer available, so could anyone tell me the DAX-world equivalent to do this? I don't think it is a measure. If it is a calculated column, how do I go about adding it?

Thanks.

[Excel 2010]
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In our hypothetical table, do we already have Breed and Species columns? If so, assuming you had a measure, say... [Total Animal] := COUNTROWS(Pets) ... it would "just" work when you put Breed on rows... or Specicies on rows... or Species AND breed on rows...
 
Upvote 0
No, they are not columns. Just Pets is the column. Within the Pets column, I'd like to GROUP the Species into Cats and Dogs.
I guess I'm trying to do the equivalent of creating a calculated ITEM that was Dogs = Collie+ Great Dane+ Poodle.
In SQL, I'd just create a new column with CASE when PETS IN (Collie, Great Dane, Poodle) THEN 'Dogs' END.
But let's assume I do not have access to change the source data and must do this using Excel and PowerPivot.
 
Upvote 0
use a helpcolumn to determine if it is a cat or a dog (in your Original data).

You can use a table and VLookup for that kind of work.
 
Upvote 0
Your only real choice is to add a calculated column. =IF ([Breed] = "Collie" || [Breed] = "Great Dane" || [Breed] = "Pug", "Dog", "Cat")
 
Upvote 0
I agree with Scott. One additional thing, you might try SWITCH if you find yourself needing a bunch of nested IFs. SWITCH accomplishes the same thing, but is easier to read in many cases. You can add as many conditions as you want, with the last argument being a catch-all like a final ELSE.

For Scott's example it would look like this:

Code:
=SWITCH([Breed],
"Collie","Dog",
"Great Dane","Dog",
"Pug","Dog",
"Cat"
)
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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