Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
miguelbraga
Valued Contributor III

Wrong Pivot Table Values

Hi community,

I have a new problem in my dashboard, when I enable the "Show Partial Sums" in the Presentation Tab in my Chart Properties, I get a wrong value. In the snapshot bellow you can see it clearly that there is something wrong with the value:

Sem Título1.png

My dimensions are:

  • [Zona]
  • [CodLocal] labeled as [Cod. Local]
  • [CodEmpregado] labeled as [Cod. Funcionário]

My expressions are:

  • =sum(CustoReal) -> labeled as [€ Custo Real]
  • =sum(CustoReal)*num(sum({$<Zona=, CodLocal=, CodEmpregado=, data= >} DISTINCT Imputacao%)) -> labeled as [Imputação]

The [Imputacao%] values table:

Sem Título2.png

What is the changes that I need to make to get the correct output result (1 316,41 €) for the totals of [Imputação] and (3 949,22 €)?

Can you experts help me? hicgwassenaarsunindiajontydkpi‌ can you help me? Anyone?


If anyone needs further more explanation, please ask it in the comment section bellow.


Regards,

MB

1 Solution

Accepted Solutions
miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

This was the solution that I could by myself get:

Sem Título3.png

With the expressions be like:

  • %Imputação -> =Sum(Imputacao%)
  • € Imputação -> =Sum(Aggr(((tempo*1440)/60)*(ValorHora)*(Imputacao%), Zona, CodLocal, [CodEmpregado], [DataHora], [Saída]))
  • € Custo Real -> =Sum(Aggr(((tempo*1440)/60)*(ValorHora), Zona, CodLocal, [CodEmpregado], [DataHora], [Saída]))

Hope someone find a similar problem in the future and that this answers may give you a similar solution. Have fun and good job people

10 Replies

Re: Wrong Pivot Table Values

Most likely you will need to use Dimensionality() function to use different expressions for your Partial Sum Rows. Do you have a qvw sample we can look at?

miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

I'm afraid I can't have the permission to share a qvw sample, due to privacy policy from my client . How can I use the Dimensionally() here?

Re: Wrong Pivot Table Values

I wouldn't use dimensionality unless I wanted a different calculation on the totals - i.e. different from what I have on the rows. In your case, You want Sum(CustoReal) everywhere right?

No, if the subtotals are wrong, I'd say your data model is wrong. QlikView calculates correctly. It could e.g. be that the same dollar is asigned to several "Cod.Local" or to several "Zona". Then you would get exactly what you have here: A total that indeed is summed correctly in the fact table, but does not correspond to the sum of the lines in the pivot table.

My guess is that the "Zona" isn't connected to the data at all: Note that CBRASS is 398.50 no matter which "Zona" you look at.

HIC

PS If you create a text box with =Sum(CustoReal) in it, what do you get? This number is the true number in your data model.

miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

Hi sunindia,

Recently I've had the permission to develop a sample qvw so that I can share with my problem in it

Regards,

MB

Not applicable

Re: Wrong Pivot Table Values

The problem is the table Zona, probability you joined Zona with Local and duplicated..

miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

If you see the Data Model, there is no duplication of Zona. Thanks for answering for my question

Not applicable

Re: Wrong Pivot Table Values

so, maybe the table Zona isn't relationship with Fact..

miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

Hi Marcos, my field Zone is linked with a table called PresenteFuturo and that's our fact table.

miguelbraga
Valued Contributor III

Re: Wrong Pivot Table Values

Hi hic‌ have you view my qvw sample?