How do I modify a specific category

I have categories “G&A, R&D, S&M, CoGS” with some monthly costs data calculated in a few previous steps.
Now I would like to add some stuff to a specific category only, e.g. “G&A”.

To do so I saw two options which are not ideal in my opinion:

(a) Add variable to the categories with the stuff to add and only fill for G&A and keep the other categories 0. This adds a lot of unnecessary parameters to the models which are always zero.

(b) Filter the costs to category “G&A” and add stuff there. However, the categories are lost afterwards and I don’t see any option to “re-join” them to a category array afterwards.

Is there a more elegant way to modify only a specific category in a formula? E.g. “if a.category = xy then a+b else a”

I wasn’t able to find any documentation.
Thanks for help in advance.

Hey @nikpan - good question! Yes, you can use category items in if statements to dynamically define a variable’s categorical values.

The two screenshots below show two different ways of doing this, the second method using a list (i.e. if Department is in Sales or Marketing).


Thanks for your answer. This actually worked and was easier than expected.

1 Like