How to Create an Editable Pivot View in Odoo v15 - pivot

Is there a way to make a pivot table (that is NOT aggreagated) editable directly from the pivot view in Odoo (I'm using Odoo v15)?
For example let's say I have my model as the following:
product_id
date
qty
p1
01/11/2021
10
p1
01/12/2021
20
p2
01/11/2021
30
and I want to use a pivot view to show the table by date columns and qty as values (NO aggregation will be used, meaning NO sum/avg/count funtions are needed) while making the pivot table editable so the user can edit the values directly, see bellow example for reference:
product_id
01/11/2021
01/12/2021
p1
10
20
p2
30
0
Please let me know if you have any ideas how to do so. Thanks!

Related

Count of KPI from different tables based on date

I have the following 4 tables and i want to show the count of ID's for each KPI's for each Caseload (1,2,3,4 etc ) something like in the second picture.
I am not sure what is the correct method but i've created a date table and use as slicer because one iD might be in a all 4 table but the KPI*Date might be different.
Any ideeas how to calculate this ?

Excel - De-cumulate data in pivot table

Hope you'll be able to help me.
I have a table with 11 columns, the first one is a date, the next 9 ones are a way of uniquely identifying data and the 11th is a certain amount of money.
What I'm doing in a pivot table is showing the added amount according to one of the identifiers (lines) and dates (columns).
All is well and quite easy to do in a pivot table. Today though I was told that the amounts in my source table are actually cumulative since the beginning of the year.
What I mean is that there are recurring entries in that table and that if I have an entry with the 9 identifiers in january and the same in february and march for example, the value of the one in february is actually (february-january) and for march (march-february).
I could through the unique identifiers just add a column in my source table to identify and calculate the real amount, but I was wondering if there was a way to do so in the pivot table directly ?
Thanks !
Edit :
Here is a screenshot of a simplified version (only two identifiers)
In the fourth column is the amount I have, and in the fifth the real one, that I have to calculate, it is quite easy with only two columns as identifiers.
The goal here is that the pivot table at the bottom shows the "real" amount without me having to create a new column in my source table.
My example table
You can do it using Calculated Items. But it is cumbersome.
A Calculated Item is just another item that a Pivot Table field can take. It is defined in terms of the other items in the same field. For example, the field Date might have values of Jan17, Feb17, etc. A new calculated item called Difference can be added to the Date field and defined as =Feb17-Jan17. This new Difference item will appear whenever the Date field is used to provide row or column labels and the values displayed for it in the main body of the pivot table will be equal to the corresponding values for Feb17 less those for Jan17.
The discussion below is based (loosely) on the pivot table in the picture accompanying the question.
Calculated Items cannot be calculated on grouped fields, so it will be necessary to ungroup the Date field in the pivot table. This will cause the items in the field to be displayed in the same dd/mm/yyyy format as the source data. Changing these to the custom format of mmmyy makes them easier to work with. In English (rather than French) they get displayed as Jan17, Feb17, etc. using this format.
To add a new Calculated Item to the Date field, select any item in this field and locate the Calculated Item option via the ribbon. This has changed across versions of Excel, in Excel 2010 it is accessed via the "Fields, Items & Sets" button of the "Pivot Table Tools/Options" tab of the ribbon. In later versions it accessed via the "Calculations" button of the same tab. A dialog box will appear as illustrated below.
In the Name: box insert a suitable name such as Feb17Xand in the Formula: box enter =IF(Feb17=0,0,Feb17-Jan17). Click "Add" then "OK". The new Date item labelled Feb17X will appear in the pivot table and will show values of 20, 0 and 0 against projects A, B and C respectively.
Feb17X is the decumulated Date item for February. The IF is necessary because although the Amountvalues are cumulative, they only appear in the source data whenever a new Amount occurs in the month (for example Project B and Department IS has data showing for April and June but not for May).
Similar decumulated Date items can be defined in the same way for the other months.
For March, Mar17X is defined as
=IF(Mar17=0,0,Mar17-(Jan17+Feb17X))
and a new Mar17X item is added to the Date field. Unfortunately, this shows values of -28, 0 and 0 against projects A, B and C, respectively. To get the correct values displayed, it is necessary to add the Department field to the row labels in the pivot table (below the Project field) and then to use the "Collapse Entire Field" operation to stop the detail of the Department field from being visible.
The calculated items for the remaining months are added as expected - that for June is Jun17X and has formula
=IF(Jun17=0,0,Jun17-(Jan17+Feb17X+Mar17X+Apr17X+May17X))
Once the new items have been defined for the Date field, a filter is applied in the pivot table to remove the cumulative items ie, Feb17, Mar17, Apr17, May17 and Jun17. This results in the pivot table displaying the sum of the decumulated values as shown below.
A few points:
The zeroes in the pivot table can be suppressed from display by setting the number format of the Amount field to #
In the larger problem where each Amount is defined by a Date, Project and 8 further field values, the row labels of the pivot table will need to include Project and all 8 of the attribute fields. The latter 8 fields will need to be "collapsed out" of the display.
It is much, much simpler to add a decumulated Amount column to the
source data range rather than using the Calculated Item approach set
out here. Sorting the source data by the 9 attributes (Project
first then the remaining 8) and then by Date makes the task
of decumulation very easy. Simply compare the 9 attributes in a row
with the previous row: if the values are unchanged between the two
rows, subtract the previous row's Amount from the current row's,
otherwise leave the current row's Amount unchanged.

DAX Rank by Date

I am Counting on Distinct ID's in a column - this is leading to the sum of the subtotals not equalling the grand total as follows:
What I want to do is rank the Payment Dates in cronological order and select ONLY the highest date to display. In the example above the Grand Total won't change, but the Townville row will not show a Distinct Student Count.
This is a very specific requirement and I'm assuming there's an easy way to do it in DAX - I've tried playing around with both RANKX and MAX but am no closer to solving this.
One last thing - the Rank must be contextual to the Time Filter selected by the user (so if they select 2015 it'd give the second record Rank 1 and the top record wouldn't show. If they select May 2015 it'd give the top record Rank 1 and the second record wouldn't show)
I think this is what you are looking for - I added a calculated column to the PowerPivot model that provides a rank based on the Last Payment Date and the Name of the Student. It will rank the earliest payment for any student as a 1.
The code for the column is as follows:
=RANKX(FILTER(Table1, [Student Name] = EARLIER([Student Name])), [Last Payment Date])
... assuming your table is named "Table1"!
The FILTER is the key that limits the ranking to dates belonging to students with that name only.
Update for Multiple tables
To set up relationships between the tables, go to the "Diagram View" of the model, available in the Home tab of the Power Pivot window.
You can drag fields from one table to the other to create relationships. This will only work if at least one of the fields is unique - it's a good idea to think of the model as a dimensional model, with a tables that acts like a fact and other tables around it that act like dimensions.
From the comment, I would try to get the Payments to act like the fact, and have it link to the Community and Student tables. in this case, you could then have the following code:
=RANKX(FILTER(Table1, Related('Students'[Student Name]) = EARLIER('Students'[Student Name])), [Last Payment Date])
This calculated column would be on your Payments Fact table, and it uses a lookup to a related field.
Note that in this specific case, it would be easier to just run the filter over your Student ID field that is used to lookup the Student name.

Unable to Create a Sub-Total in the POWERPIVOT

I am pretty new with POWERPIVOT tables. I have searched for a bit of time now to resolve my problem but I have been unsuccessful so far. As you can see below, I have created a POWERPIVOT table in Excel 2013 that is composed of two FACT tables, which are based on: 1) a sheet where the clients can insert vote 1 budget entries; and, 2) another sheet where the clients can insert vote 5 budget entries. Also, a few DIMENSION tables have been added to the combination in order to link the Branch names and the expenditure type. Please note that this is only a simple example of what I am trying to produce.
However, my main problem is that I can't add a sub-total that would sum Salary, Operating and Revenues for Vote 1 and Vote 5 separately. What I would like to show is the following:
Please note that I have tried calculated columns and calculated fields at the best of my knowledge but the results are always showing another set of columns for Salary, Operating and Revenues but what I need is just one column that sum the three components so it displays Salary, Operating, Revenues and Sub-Total. Does anyone know how to resolve this problem that I am facing since a long time?
Thanks to gurus.
I would suggest that you start by putting both budgets in the one table and an extra column to designate Vote id., Otherwise I fearyou will need to add a calculated column concatenating the Branch and Expenditure Type in each table, then doing a LOOKUPVALUE from Vote1 on the concatenated column to Vote5 and pull back the value.

Pivot like query access

I am having a huge database of records and I'm finding it to be a nightmare getting to analyse the data.
Objective:
Group my data by Country of Purchase (rows), by Years/Months (rows), by Product (columns) with the Sum of Paid amount being the value.
Let me explain:
Below is a sample excerpt from my table.
And here is the result that I am looking for that I was able to achieve using an Excel Pivot table:
Why use MS Access:
My table has over 3 million records stored across many workbooks, and Excel has a limit of 1m in each sheet. Also Excel crashes more often than not when loading >500k of data.
I installed an older version of MS Access (2010) which has pivot tables option but it was very slow and did not allow me to group correctly. I then tried using a combination of queries and reports to arrive to my result to no avail.
Any help will be very welcome :)
How about doing the aggregation in Access and then the pivot in Excel?
SELECT country, year, month, product, sum(paid)
FROM myTable
GROUP BY country, year, month, product
(year and month based on access functions for date manipulation... alternatively, you could use is as a date to keep date functionality in the pivot - just make it the first of the relevant month)
Then use this as the source of the pivot table. The pivot table then basically just does the formatting - which it can hopefully do quickly enough

Resources