Is there a way to custom sort records in a Google Data Studio table?

6k Views Asked by At

Is there a way to custom sort rows in a Google Data Studio table with drill downs enabled?

For example, is there a way to order the table with rows 3,5,1 etc...

I tried adding a custom field Sort ID before drill down Item 1 using a case statement when Item 1 = "NIM" then 1 (or A) etc.. and then add it as a dimension and then sort based on that, but it doesn't seem to work.

Any suggestions greatly appreciated!

enter image description here

2

There are 2 best solutions below

0
On

I managed to do it in a hacky way:

  1. Added SORT ID to the underlying data
  2. In Manage Blended Data, I included SORT ID as the last column using MIN with all the same primary key links as other columns
  3. Sorted by Sort ID
  4. Put a box over with the same color as the background

Hoping that there is a better way? enter image description here

enter image description here

0
On

Another hacky method: insert different numbers of zero-width spaces (see this website to copy-paste) before each value in your field (in this case, Item1), and sort alphabetically by Item1.

Since strings are sorted alphabetically (first character, then second character, etc.) by their ASCII/Unicode numbers, you can add different numbers of zero-width spaces to achieve the desired order. The zero-width space has a Unicode number of U+200B, so it's like adding a bunch of zs before the string. For example:

Item1
---
NIM
[U+200B]NII
[U+200B][U+200B]REv
[U+200B][U+200B][U+200B]Direct
[U+200B][U+200B][U+200B][U+200B]Alloc
[U+200B][U+200B][U+200B][U+200B][U+200B]Exp