Bug 68666 - PIVOTTABLE: function GETPIVOTDATA does not return data
Summary: PIVOTTABLE: function GETPIVOTDATA does not return data
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-08-28 14:32 UTC by Guillaume Mortier
Modified: 2013-12-06 23:22 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
sample data, two pivot tables with the same use of GETPIVOTDATA function, one OK, one KO (9.52 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-08-28 14:32 UTC, Guillaume Mortier
Details
Modified sample (9.83 KB, application/xml)
2013-09-02 23:22 UTC, m_a_riosv
Details
screen capture of a case that worked with 4.0 (143.91 KB, image/png)
2013-09-04 06:24 UTC, Guillaume Mortier
Details
tescase under 3.5.7.2 - linux (54.70 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-09-06 16:41 UTC, Guillaume Mortier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Mortier 2013-08-28 14:32:12 UTC
Created attachment 84797 [details]
sample data, two pivot tables with the same use of GETPIVOTDATA function, one OK, one KO

Problem description: GETPIVOTDATA returns error #REF! when more than 1 line field is used 

Steps to reproduce:
1. create some data (see attachment)

2. create pivot table with just one line field, one column field and use GETPIVOTDATA to test all is OK

3. just add a second line field in the pivot table : the function then return error #REF!


This was working fine with version 4.0

Bug appeared with 4.1.0 release, replicated with 4.1.1.1, Build ID: a990db030b8125868501634ff662be1d89d0868)

              
Operating System: Windows 7
Version: 4.1.0.4 release
Comment 1 m_a_riosv 2013-09-02 23:22:39 UTC
Created attachment 85092 [details]
Modified sample

Hi Guillaume, thanks for reporting.

There several results for your criteria in the formula:
=GETPIVOTDATA("How long (h)";F12;"What";"activity 1")
what must be for you.

You need to set up a criteria searching for an unique result, like:
=GETPIVOTDATA("How long (h)";F12;"Who";"bill";"What";"activity 1")

It is possible what you want, moving the "What" field to the first column and edit the layout to set up "What" to sum for it.
Comment 2 m_a_riosv 2013-09-02 23:23:07 UTC
Not a bug for me.
Change to RESOLVED NOTABUG, please if you are not agree reopen it.
Comment 3 Guillaume Mortier 2013-09-03 06:13:45 UTC
Hi Mariosv,


I don't understand why the function GETPIVOTDATA has now a different behaviour, depending on the layout of the pivot table. 

Now, it seems that we must specify as many search criteria as we have line fields displayed.

In previous versions, it was not the case.


--> can this be considered as a regression ?
Comment 4 m_a_riosv 2013-09-03 21:51:31 UTC
Sorry Gillaume, but the result is the same for me with 3.5.7.2 and 4.0.5.2.
In J5: 4, in J12: #REF!.
If there are several results for the criteria, it is no possible that GETPIVODATA() can know which of them must return. That is the case in J12.

Please what are the version working fine for you?
Comment 5 Guillaume Mortier 2013-09-04 06:24:54 UTC
Created attachment 85169 [details]
screen capture of a case that worked with 4.0

This file was made at the end of May, with version 4.0.3 I think.

The formula in cell P6 worked at that time, and returned 19908.


Here, we have 3 line fields ("Groupe", "Recept" and "Nom") and 1 column field, and the formula just queries for the total of data field "somme - exped" for one particular value of "recept".
In short, the formula should return the total value that is displayed in cell H6.
Comment 6 m_a_riosv 2013-09-04 18:44:24 UTC
Maybe something change form when was done, try moving "Nom" before "Recept."

Your first attached file as I mention in comment #4 doesn't work in 3.5.7.2 neither 4.0.5.2
Comment 7 Guillaume Mortier 2013-09-06 16:41:42 UTC
Created attachment 85365 [details]
tescase under 3.5.7.2 - linux

Test case with version 3.5 :

The call to function GETPIVOTDATA is made specifying only one line field and a given value. And it works...

In fact, in this case, the function return a value even if "group" and "who" have not been specified, because there is no ambiguity.



Testing the same with version 4.X.X fails...
Comment 8 m_a_riosv 2013-09-06 17:27:33 UTC
Hi Guillaume,

Works for me in:
3.5.7.2
4.0.5.2

does not work in:
Version: 4.1.2.0.0+ Build ID: aa9bef8271ed50a397c959ed53c91ee44b3dcb1
TinderBox: Win-x86@6-debug, Branch:libreoffice-4-1, Time: 2013-09-03_11:55:14

But I am not sure what it the right way.

Duplicating the 101 in source table and updating the PT, all versions results in #REF! because there is an ambiguity with more than one row in PT with 101.

In any case seems a regression if not is a design change.
Comment 9 Kohei Yoshida 2013-12-06 20:27:15 UTC
Unfortunately the previous behavior of accepting this pattern was a mistake. It's supposed to return #REF! when the filter rule may have more than one hit, as in this case.

So, technically this is not a regression.

The previous GETPIVOTDATA implementation unfortunately didn't throw an error even when it should have.  The use case reported in this bug report is one example of that.
Comment 10 m_a_riosv 2013-12-06 23:22:41 UTC
Khoei, thanks for explaining what should be the behavior, it was my first suspicion, comm#1, but always a problem for users when a behaviour change, specially in case like this, where the correction implies a change from work to non work.
If was possible a way doing easy to find information about this kind of corrections, e.g. a Behaviour changes at the end of the list in the help contents.

Changed the status to RESOLVED NOTABUG.