mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[data grid] Implement Pivoting

Open oliviertassinari opened this issue 4 years ago • 43 comments

What a pivot table is?

TLDR

Transform row data from given selected field(s) into column headers; values under these columns are aggregations of all the rows that share the same value on the selected fields(s)

A pivot table is a statistics tool that summarizes and reorganizes selected columns and rows of data in a spreadsheet or data table to obtain a desired report.

It’s an extension of the behavior of combining row grouping and aggregation. With the ability to pivot columns, users can break down the row-grouped values in a new dimension, and the aggregation functions are used to compute the crossed values between rows and columns.

It’s a tool that targets end-users and enables them to build a new table by combining different computed values based on the original dataset.

How does pivoting work?

A pivot table is built over four distinct concepts.

  • Rows: When a field is chosen to provide the rows, it populates the first column with the unique values of that field. It’s the logic of Row grouping.
  • Columns: When a field is set for the columns, the unique values of that field are listed across the top as column headers. It is similar to Row grouping, but with columns. This property is what effectively gives the sense of data pivoting.
  • Computed values: When a field is chosen, its values are aggregated based on the cross between rows and columns established by the previous inputs. The most common aggregation are sum, average, minimum and maximum. It’s the logic from Aggregation, but extended to aggregate the value in multiple columns represented by a field’s unique values.
  • Filters: Filters original dataset.

Examples of use cases

  • https://www.youtube.com/watch?v=-LM6-BJd1HA

  • Extracting the sum of gold medals per country each year:

    Original dataset
    Original dataset

    Row group: Country, Columns: Year, Computed Values: Gold (sum) Row group: Country,
Columns: Year,
Computed Values: sum(Gold)

    Row group: Year, Columns: Country, Computed Values: Gold (sum) Row group: Year,
Columns: Country,
Computed Values: Gold

When a user turns on the pivoting:

  1. The Data Grid stops displaying the original dataset
  2. The Data Grid displays the tool for building the pivot table:
    • A list of all the available fields.
    • 3 inputs for columns, rows, and computed values.
    • Access to the filter panel to apply filters to the original dataset
  3. The Data Grid renders the pivot table based on which fields are used on each of the four inputs.

Where can users access this function?

At the new “Manage columns” panel https://github.com/mui/mui-x/issues/5700

Challenges

  • UI/UX design of a pivoting panel
  • Rendering autogenerated Columns (maybe Column definitions)
  • Crossing Aggregation (Rows vs columns)

Benchmark

  • https://airtable.com/marketplace/blkyAnUVk7O0NMrQp/pivot-table
  • https://help.tableau.com/current/prep/en-us/prep_pivot.htm
  • https://www.ag-grid.com/javascript-grid-pivoting/
  • https://ej2.syncfusion.com/react/demos/#/material/pivot-table/default
  • https://demos.telerik.com/kendo-ui/pivotgrid/index
  • https://demos.telerik.com/kendo-ui/pivotgridv2/index
  • https://webix.com/pivot/
  • https://www.htmlelements.com/docs/pivot-table/
  • https://js.devexpress.com/Demos/WidgetsGallery/Demo/PivotGrid/Overview/jQuery/Light/
  • Excel
Screenshot 2022-05-03 at 14 34 27

oliviertassinari avatar Aug 22 '20 22:08 oliviertassinari

im looking foward to it :D

ghost avatar Mar 11 '21 20:03 ghost

Has this been confirmed to be in Jul - Sep timeframe?

deepankarmalhan avatar Mar 24 '21 19:03 deepankarmalhan

Is this still due for Q4? Hoping to see it soon!

LukeXF avatar Sep 27 '21 22:09 LukeXF

I thought we are the only one who always extend the deadline :laughing:

shubhamgoswamiofficial avatar Sep 29 '21 11:09 shubhamgoswamiofficial

Is this feature coming out by the end of this year?

dagi377 avatar Oct 07 '21 06:10 dagi377

This feature will come out in ....

akshaykadambatt avatar Nov 29 '21 12:11 akshaykadambatt

We don't yet have a deadline for this feature. We have changed the roadmap presentation a bit. We now have an internal roadmap where we set ambitious targets and a public one where we try to under promise, so we can more consistently overdeliver.

oliviertassinari avatar Nov 29 '21 12:11 oliviertassinari

Main issue for me is that I can't make column headers stick - not being scrolled out. Maybe there is a way but I didn't see it.

KlausFabian avatar Jan 18 '22 17:01 KlausFabian

@KlausFabian Is this what you're looking for? https://mui.com/components/data-grid/columns/#column-pinning

m4theushw avatar Jan 18 '22 17:01 m4theushw

@m4theushw That looks exactly what I have been looking for!!! Thanks a lot. But does that only work with the DataGridPro?

KlausFabian avatar Jan 18 '22 20:01 KlausFabian

Hoping to see this re-prioritized - my team will definitely use this as soon as it's available.

rmrice avatar Sep 20 '22 19:09 rmrice

Looking forward to this new feature! Hope it can be prioritized

GJmelody avatar Sep 22 '22 04:09 GJmelody

Also need this!

thespencercox avatar Sep 22 '22 15:09 thespencercox

WE NEED THIS!

daee-premise avatar Sep 26 '22 15:09 daee-premise

As a customer we would like to see this re-prioritized

paulleonartcalvo avatar Oct 19 '22 18:10 paulleonartcalvo

I am new customer too; also please re-prioritized this would be amazing

Rvalle23 avatar Oct 20 '22 10:10 Rvalle23

We are in need of this feature very much, Please re-prioritize this.

srinivaassunil avatar Oct 26 '22 09:10 srinivaassunil

I'm happy to listen to your pain points, expectations, and use cases. Let us know if you're willing to give us a user interview.

joserodolfofreitas avatar Oct 26 '22 19:10 joserodolfofreitas

Hi @joserodolfofreitas ; thats an amazing initial point; we would love yo see that; let us know and in the future if any testing needed. Also; probably would connect soon; there were some issues with the export excel functionality. Kind regards, Ricardo

Rvalle23 avatar Oct 28 '22 09:10 Rvalle23

We really need this feature to make datagrid even more powerful!

davidespejo avatar Oct 28 '22 10:10 davidespejo

That's killer for us!

thiagoaragao avatar Mar 24 '23 02:03 thiagoaragao

Any updates on this ?

aimad-majdou avatar Mar 27 '23 08:03 aimad-majdou

Second that. I feel like this feature is a must.

demetriad avatar Mar 27 '23 12:03 demetriad

+1

imhazige avatar Apr 01 '23 21:04 imhazige

+1

ks0430 avatar Apr 20 '23 05:04 ks0430

+1, Please add the feature asap. We need this for our new saas.

I am dam sure many people are ready to take higher plan for the same.

h4r3en avatar May 23 '23 07:05 h4r3en

Can anyone please please provide ETA for this

h4r3en avatar May 23 '23 07:05 h4r3en

Can anyone please please provide ETA for this

I do not look forward to, can not afford, Ha Ha

vaynevayne avatar May 23 '23 08:05 vaynevayne

Really need this asap! We're on the pro now, we will upgrade to premium if this will be released soon!

olegschwarz avatar Jun 20 '23 09:06 olegschwarz

+1 for this feature

mrityunjay-cnuro avatar Jul 12 '23 15:07 mrityunjay-cnuro