evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.27k stars 201 forks source link

Pivot Table #596

Open archiewood opened 1 year ago

archiewood commented 1 year ago

Feature Description The ability to pivot tables by arbitrary columns, and aggregate the relevant rows as required

Current Solution Very Hacky SQLTM

Examples/Screenshots image

mshiner commented 1 year ago

Would love to see this implemented somehow.

There is a js pivot table that has been adapted to work with svelte https://github.com/jjagielka/svelte-pivottable#readme - does this help?

The interactive component provided by svelte-pivottable is PivotTableUI, but output rendering is delegated to the non-interactive PivotTable component, which accepts a subset of its properties. PivotTable can be invoked directly and is useful for outputting non-interactive saved snapshots of PivotTableUI configurations. PivotTable in turn delegates to a specific renderer component, such as the default TableRenderer, which accepts a subset of the same properties. Finally, most renderers will create PivotData object to handle the actual computations, which also accepts a subset of the same props as the rest of the stack.

see here https://github.com/jjagielka/svelte-pivottable#properties-and-layered-architecture

Ultimately, for me, the ability to make a pivot that looks like this would be awesome. pt2

Note this image is from this post which has the sql LibreOffice and csv files

mcrascal commented 1 year ago

Excellent syntax example on pivot tables here

jdimmerman commented 1 year ago

Morning Evidence team! Any idea gutcheck wise when this and/or https://github.com/evidence-dev/evidence/issues/744 might be in the product?

Thanks!

ItsMeBrianD commented 1 year ago

Morning @jdimmerman!

This isn't feature complete as a Pivot table (yet), and will be dependent on the upcoming Universal SQL feature, but this component plugin should resolve this issue when it is complete.

archiewood commented 1 year ago

Defer to @mcrascal but I'd put it currently as "not in the next month".

See above

What's your use case?

jdimmerman commented 1 year ago

Awesome, thanks both of you!

Great to hear about the component plugin. The use case is somewhat broad, but generally our client facing team wants the ability to drill down into aggregations within a data table, which I think the pivot table can solve for generically. Another option is to pursue a more limited use case akin to what kuatroka and you, Archie, discussed here, which very well may support their needs for some time

mcrascal commented 9 months ago

This syntax (branding tbd), looks right now that USQL is in place: https://github.com/evidence-dev/evidence/issues/468#issuecomment-1319222447

dangreenberg93 commented 7 months ago

Hi @ItsMeBrianD @archiewood - any plans for pivot tables in the near term? I saw your hacky solution archie

archiewood commented 7 months ago

It's on the todo list, but not "next up" yet

Sorry I can't be more specific!

andrejohansson commented 7 months ago

Candidate bases?