Skip to content

Instantly share code, notes, and snippets.

@Medohh2120
Created March 26, 2026 17:08
Show Gist options
  • Select an option

  • Save Medohh2120/ce02f6c5edef124df6dfce61123993fb to your computer and use it in GitHub Desktop.

Select an option

Save Medohh2120/ce02f6c5edef124df6dfce61123993fb to your computer and use it in GitHub Desktop.
Fixes GROUPBY+ HSTACK value field headers
/*
Name: GROUPBY_RETITLE
Description: Replaces the native (GROUPBY+HSTACK) value field headers with provided [custom_headers] array.
GROUPBY.[Field_headers] must equal 2 or 3.
Made By: Medohh2120
*/
GROUPBY_RETITLE = LAMBDA(groupby_result, [custom_headers],
LET(
n_value_fields, SUM(--(TAKE(groupby_result, 1) <> "")),
n_row_fields, COLUMNS(groupby_result) - n_value_fields,
row_fields_fields, DROP(TAKE(groupby_result, , n_row_fields), 1),
default_headers, TAKE(groupby_result, 1, -n_value_fields),
grid, DROP(groupby_result, 2, n_row_fields),
IF(
ISOMITTED(custom_headers),
HSTACK(row_fields_fields, VSTACK(default_headers, grid)),
HSTACK(row_fields_fields, VSTACK(custom_headers, grid))
)
)
);
@Medohh2120
Copy link
Copy Markdown
Author

GROUPBY.[Field_headers] = 3

Screenshot 2026-03-26 194848

GROUPBY.[Field_headers] = 2

Screenshot 2026-03-26 194538

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment