Skip to content

Commit 8e0696a

Browse files
committed
[IMP] spreadsheet: expanding functional documentation
Task-3595405 closes #12915 Signed-off-by: Xavier Platteau (xpl) <xpl@odoo.com>
1 parent 74d8c7e commit 8e0696a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1500
-318
lines changed

content/applications/productivity/spreadsheet.rst

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,24 @@ Spreadsheet
88
.. toctree::
99
:titlesonly:
1010

11-
spreadsheet/insert
12-
spreadsheet/functions
1311
spreadsheet/templates
12+
spreadsheet/functions
13+
spreadsheet/insert
14+
spreadsheet/dynamic_pivot_tables
1415
spreadsheet/global_filters
1516

16-
Spreadsheet lets you organize, analyze, and visualize your data in tabular form. Among others, you
17-
can:
18-
19-
- :doc:`Insert and link your Odoo data (pivots, graphs, lists, and menus) <spreadsheet/insert>`.
20-
- :doc:`Use global filters <spreadsheet/global_filters>`.
21-
- :doc:`Use formulas and functions <spreadsheet/functions>`.
22-
- :doc:`Create and use templates <spreadsheet/templates>`.
23-
- Format data.
24-
- Sort and filter data.
25-
26-
.. _spreadsheet/glossary:
27-
28-
Glossary
29-
========
30-
31-
Some of Spreadsheet's main :abbr:`UI (user interface)` elements are highlighted and defined below.
32-
33-
.. image:: spreadsheet/ui-elements.png
34-
:align: center
35-
:alt: Spreadsheet main UI elements
36-
37-
#. Menu bar
38-
#. Top bar
39-
#. Formula bar
40-
#. Filters button
41-
#. Row header
42-
#. Column header
43-
#. Cell menu
44-
#. Bottom bar
17+
**Odoo Spreadsheet** allows you to organize, manipulate, analyze, and visualize data. It offers
18+
similar functionality to other spreadsheet solutions with the added benefit of integrating directly
19+
with your Odoo database.
20+
21+
With **Odoo Spreadsheet**, you can:
22+
23+
- create spreadsheets or upload existing `.xlsx` files and edit them
24+
- create :doc:`templates <spreadsheet/templates>`
25+
- :doc:`use functions, including Odoo-specific functions <spreadsheet/functions>`
26+
- :doc:`insert and link to Odoo data <spreadsheet/insert>`
27+
- :doc:`create and use dynamic pivot tables <spreadsheet/dynamic_pivot_tables>`
28+
- filter data across multiple Odoo data sources using :doc:`global filters
29+
<spreadsheet/global_filters>`
30+
- visualize data using charts and formatting
31+
- share files internally and externally
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
====================
2+
Dynamic pivot tables
3+
====================
4+
5+
When a pivot view from an Odoo database is inserted in a spreadsheet, it is by default a static
6+
pivot table. Each cell in a static pivot table contains an :ref:`Odoo-specific function
7+
<spreadsheet/insert/pivot-table-functions-static>` that retrieves data from your database.
8+
9+
.. image:: dynamic_pivot_tables/pivot-function-static.png
10+
:alt: Function of static pivot table cell
11+
12+
When the corresponding data in your database changes, e.g., the sales related to a given quarter or
13+
an individual salesperson, the cells of your static pivot table are updated.
14+
15+
However, a static pivot table does not expand automatically to accommodate new data, e.g., sales
16+
data for a new quarter or for a newly hired salesperson. Neither is it possible to add or manipulate
17+
dimensions (i.e., columns or rows) or measures via the pivot table properties.
18+
19+
.. note::
20+
If you attempt to update or manipulate the properties of a pivot table that has just been
21+
inserted into a spreadsheet, an error message appears in the top right corner of the screen:
22+
23+
.. image:: dynamic_pivot_tables/pivot-table-error.png
24+
:alt: Error message when trying to manipulate static pivot table
25+
26+
To have more flexibility in how you can manipulate your pivot table, you can :ref:`create a dynamic
27+
pivot table <spreadsheet/dynamic-pivot-tables/create>` from a static pivot table.
28+
29+
.. _spreadsheet/dynamic-pivot-tables/create:
30+
31+
Create a dynamic pivot table
32+
============================
33+
34+
There are two main ways to create a dynamic pivot table from a static pivot table:
35+
36+
- **Duplicate the static pivot table from the pivot table properties**: :ref:`Open the pivot table
37+
properties <spreadsheet/insert/pivot-table-properties>`, click the :icon:`fa-cog`
38+
(:guilabel:`gear`) icon at the top right of the pane, then click :icon:`fa-clone`
39+
:guilabel:`Duplicate`.
40+
41+
A new data source is created and a dynamic version of the pivot table is inserted into a new
42+
sheet. The dynamic pivot table has the same styling as the original pivot table.
43+
44+
.. note::
45+
When you use this method, your new dynamic pivot table gets the next available pivot ID. This
46+
means you can create multiple pivot views associated with the same model, but with distinct
47+
settings, groupings, or calculations.
48+
49+
- **Re-insert the dynamic pivot table from the Data menu**: On the sheet that contains your static
50+
pivot table, position your cursor in an empty cell. Click :menuselection:`Data -->`
51+
:icon:`os-insert-pivot` :menuselection:`Re-insert dynamic pivot` from the menu bar, then select
52+
the relevant pivot table.
53+
54+
A new, dynamic pivot table appears, with the same styling as the original pivot table.
55+
56+
.. note::
57+
When you use this method, your static and dynamic pivot share the same data source, and,
58+
consequently, the same pivot ID. To avoid confusion, delete the original static pivot table.
59+
60+
.. tip::
61+
It is also possible to directly enter the :ref:`function
62+
<spreadsheet/dynamic-pivot-tables/functions>` of the dynamic pivot table in an empty cell.
63+
However, with this method, the table styling needs to be re-applied manually.
64+
65+
.. _spreadsheet/dynamic-pivot-tables/functions:
66+
67+
Dynamic pivot table functions
68+
-----------------------------
69+
70+
Instead of each cell containing a unique function that retrieves data from your database, as in a
71+
:ref:`static pivot table <spreadsheet/insert/pivot-table-functions-static>`, a dynamic pivot table
72+
has a single function:
73+
74+
.. code-block:: text
75+
76+
=PIVOT(pivot_id, [row_count], [include_total], [include_column_titles], [column_count] )
77+
78+
The arguments of the function are as follows:
79+
80+
- `pivot_id`: the ID assigned when the pivot table is inserted. The first pivot table
81+
inserted in a spreadsheet is assigned pivot ID `1`, the second, pivot ID `2`, etc.
82+
- `row_count` and `column count`: the number of rows and columns respectively.
83+
- `include_total` and `include_column_titles`: values of `0` remove the total and column
84+
titles respectively.
85+
86+
This is an array function, which allows the pivot table to expand automatically to accommodate the
87+
results of the function.
88+
89+
The top-left cell contains the editable function, while clicking on any other cell reveals this
90+
formula greyed out.
91+
92+
.. image:: dynamic_pivot_tables/pivot-function-dynamic.png
93+
:alt: Array function of a dynamic pivot table
94+
95+
.. tip::
96+
If necessary, you can update the function of a dynamic pivot table to remove elements like the
97+
total or column titles.
98+
99+
With the function open in the formula bar or the top-left cell of the pivot table, position your
100+
cursor after the pivot ID then type `,` to advance to the optional field you want to modify. In
101+
the example below, adding the value `0` for `[include_total]` removes both the row total and
102+
column total from the pivot table.
103+
104+
.. image:: dynamic_pivot_tables/modify-function.png
105+
:alt: Modifying the function of a dynamic pivot table
106+
107+
.. _spreadsheet/dynamic-pivot-tables/manipulate:
108+
109+
Manipulate a dynamic pivot table
110+
================================
111+
112+
To manipulate data in a dynamic pivot table, :ref:`open the pivot table properties
113+
<spreadsheet/insert/pivot-table-properties>`.
114+
115+
The following options are available by clicking the :icon:`fa-cog` (:guilabel:`gear`) icon:
116+
117+
- :icon:`fa-exchange` :guilabel:`Flip axes`: to move all the dimensions represented in columns to
118+
rows and vice versa.
119+
120+
.. tip::
121+
Flipping the axes presents the data from a different perspective, possibly bringing new
122+
insights. However, depending on the volume of data, it can result in #SPILL errors. This
123+
happens when a formula tries to output a range of values, but something is blocking those
124+
cells, such as other data, merged cells, or the boundaries of the current sheet.
125+
126+
Hovering over the cell containing :guilabel:`#SPILL` details the error.
127+
128+
- :icon:`fa-clone` :guilabel:`Duplicate`: to duplicate the dynamic pivot table and create a new data
129+
source with distinct properties.
130+
- :icon:`fa-trash` :guilabel:`Delete`: to delete the data source of the dynamic pivot table.
131+
132+
.. note::
133+
Deleting the data source of a pivot table does not delete the visual representation of the
134+
data. Delete the table from the spreadsheet using your preferred means, e.g., via keyboard
135+
commands, spreadsheet menus, or by deleting the sheet.
136+
137+
.. _spreadsheet/dynamic-pivot-tables/manipulate-dimensions:
138+
139+
Dimensions
140+
----------
141+
142+
The dimensions of the pivot table, i.e., how the data is grouped, are placed in :guilabel:`Columns`
143+
and :guilabel:`Rows` according to how they appeared in the pivot view in your database, i.e., before
144+
the pivot table was inserted in the spreadsheet.
145+
146+
You can:
147+
148+
- add new dimensions by clicking :guilabel:`Add`
149+
- delete existing dimensions by clicking the :icon:`fa-trash` :guilabel:`(delete)` icon on the
150+
relevant dimension
151+
- change the order in which dimensions are displayed in :guilabel:`Columns` or :guilabel:`Rows` by
152+
clicking then dragging the dimension to the desired position within its respective section
153+
- change the axis on which a dimension is shown by clicking then dragging the dimension from
154+
:guilabel:`Columns` to :guilabel:`Rows` or vice versa
155+
- change how a dimension's values are ordered by selecting :guilabel:`Ascending`,
156+
:guilabel:`Descending`, or :guilabel:`Unsorted` in the :guilabel:`Order by` field
157+
- for date- or time-based dimensions, select the desired :guilabel:`Granularity` from the options in
158+
the dropdown menu
159+
160+
.. _spreadsheet/dynamic-pivot-tables/manipulate-measures:
161+
162+
Measures
163+
--------
164+
165+
The measures of your pivot table, i.e., what you are measuring, or analyzing, based on the
166+
dimensions you have chosen, are listed in the order they appeared in the pivot view in your
167+
database.
168+
169+
You can:
170+
171+
- add new measures, including :ref:`calculated measures
172+
<spreadsheet/dynamic-pivot-tables/manipulate-measures-calculated-measures>`, by clicking
173+
:guilabel:`Add`
174+
- hide (:icon:`fa-eye`), show (:icon:`fa-eye-slash`), or delete (:icon:`fa-trash`) existing measures
175+
- edit the name of existing measures by clicking on the measure's name
176+
- change the order in which measures are displayed by clicking then dragging the measure to the
177+
desired position
178+
- change how measures are displayed by clicking the :icon:`fa-cog` :guilabel:`(gear)` icon, then
179+
selecting the desired option from the dropdown menu, e.g., :guilabel:`% of grand total` or
180+
:guilabel:`Rank smallest to largest`. The pivot table data updates dynamically as different
181+
options are selected.
182+
- choose how measures are aggregated, e.g., by :guilabel:`Sum`, :guilabel:`Average`,
183+
:guilabel:`Minimum`
184+
185+
.. _spreadsheet/dynamic-pivot-tables/manipulate-measures-calculated-measures:
186+
187+
Calculated measures
188+
~~~~~~~~~~~~~~~~~~~
189+
190+
It is possible to add calculated measures if the desired measure did not exist in the original pivot
191+
view. For example, a calculated measure could be added to show the average revenue per order or the
192+
profit margin per product.
193+
194+
To add a calculated measure:
195+
196+
#. From the :guilabel:`Measures` section of the pivot table properties, click :guilabel:`Add`.
197+
#. Below the scrollable list, click :icon:`os-formula` :guilabel:`Add calculated measure`.
198+
#. Rename the calculated measure by clicking on the name and typing.
199+
#. Click on the line starting with `=` and enter the formula.
200+
201+
.. example::
202+
In the below example, the average revenue per order is added by dividing the sum of the sales
203+
by the number of orders.
204+
205+
.. image:: dynamic_pivot_tables/calculated-measure.png
206+
:alt: Formula for a calculated measure
207+
208+
#. Choose how the measure should be aggregated by selecting a value from the dropdown.
209+
210+
.. tip::
211+
There are advantages to using a static pivot table, for example, being able to see the functions
212+
behind individual cells. To have this possibility, select the relevant portion of your dynamic
213+
pivot table, copy it, then paste it into an empty part of the sheet. Click on any pasted cell to
214+
see the :ref:`Odoo function <spreadsheet/functions/odoo>` used to retrieve the data.
215+
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)