Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

bwisealiahmad
Valued Contributor

Wrong with calculation? Don't understand what I am doing wrong

Hi,

I've made a fact table with some information:

Sum(NettNet) - How much money was made that period

% of Total - Supposed to be multiplied with Sum(NettNet) to get a certain amount that was made that day

Sum(NettNet) * % Of Total = Sum(Omsetning)

I did all of this is the script.


When I have % Of Total and Omsetning as Dimensions they show right values. Moment I try to Sum them to up to them as Measures the numbers become much higher.


Any ideas?


Sum(NettNet) should be the same as Sum(Omsetning) just that Sum(Omsetning) is the daily value that sums up to the total of Sum(NettNet)


Doh.JPG

1 Solution

Accepted Solutions

Re: Wrong with calculation? Don't understand what I am doing wrong

Your Sum() expressions are exactly 9x the Omsetning and % Of Total values. Which means they occur 9 times within your Dimension, in this case Dato.  Take a look at your data model using Preview in the Data Model Viewer and try to understand why you have duplicates in your data model.


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

4 Replies
eduardo_dimperi
Valued Contributor II

Re: Wrong with calculation? Don't understand what I am doing wrong

Hi Ali,

Try SUM(Distinct YourField)

bwisealiahmad
Valued Contributor

Re: Wrong with calculation? Don't understand what I am doing wrong

Hi,

You can see on  row 4 & 5 it looks like the same values so I don't want it distinct.

What I am trying to understand if it is a modeling error or what I've done.

Re: Wrong with calculation? Don't understand what I am doing wrong

Your Sum() expressions are exactly 9x the Omsetning and % Of Total values. Which means they occur 9 times within your Dimension, in this case Dato.  Take a look at your data model using Preview in the Data Model Viewer and try to understand why you have duplicates in your data model.


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

bwisealiahmad
Valued Contributor

Re: Wrong with calculation? Don't understand what I am doing wrong

Hi,

Was missing a Distinct  on a Interval Match join

Thank you!


Best,

Ali A