How do I change the order of categories?

I currently have an input that is linked to two categories via a google sheet dataset: Billing Class and Location.

In my model, when I add the input it shows the categories as a hierarchy “Enrollment > Billing Class > Location”.

I would like to change the hierarchy order so that it goes “Enrollment > Location > Billing Class.”

How would I go about doing that?

image

Hi @Tierney_Santoro, Great question! Currently, we’re not preserving the order of categories coming from a data source (I just created a task for our engineering team to fix that).

Here’s a hack that should work for now. Create a variable called “Category Order Hack”, set the value to “0”, and then apply all the categories in the right order.

Then in your variable that has the incorrect order just add “+ {{Category Order Hack}}” to the formula.

1 Like

Hi @Lukas - has there by any chance been an update to this?

Best,
Anton

Hey Anton, No update yet unfortunately. The hack is still the best way to do it. We’ll update you on this thread when we have a better way. Sorry!

At long last @Anton_Gustafsson & @Tierney_Santoro - you can now easily re-order categories on a variable :partying_face:

For example, if you have a variable broken down by City and then Segment, you can swap the order around so it is Segment and then City instead.

This will of course not change any calculations, it will just change the category ordering that you see when you expand the variable.

To access this, hit the category button on the variable (or cmd/ctrl+2) and then drag to re-order the categories.

Happy holidays :gift:

Drag to re-order category hierarchy on a variable

1 Like

Thanks @heidi_causal

Happy holidays!