# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for
Did you mean:
Highlighted Creator

## Calculated Dimension using sum() function not working

Hi all,

I have a problem regarding using a calculated dimension.

The expression looks as follows:

=if (sum () = sum () , Store)

This expression should only show me the Stores where A equals to B, but I'm getting

an error that states //Error in calculated dimension

Do you maybe have a solution to my problem?

Thanks! Tags (4)
1 Solution

Accepted Solutions
Highlighted Not applicable

## Re: Calculated Dimension using sum() function not working

try to create a new dimension at back end for the same condition then use this at front end,at front end creation of this kind of calculated dimension is not recommended...

7 Replies
Highlighted MVP

## Re: Calculated Dimension using sum() function not working

You cannot use Sum in a dimension field until you use aggr.

So you should change the formula to something like

if (Aggr(sum (, mydimension)) = Aggr(sum (,mydimension)) , Store)

but this is not reccomanded because performance decrease

Highlighted Not applicable

## Re: Calculated Dimension using sum() function not working

try to create a new dimension at back end for the same condition then use this at front end,at front end creation of this kind of calculated dimension is not recommended...

Highlighted MVP

## Re: Calculated Dimension using sum() function not working

Hi,

Rather than use of SUM in expression use variables and store that value into the variable and use the variable for condition check but it is not correct way. But if it is need you can go for variables.

Regards,

Anand

Highlighted MVP & Luminary

## Re: Calculated Dimension using sum() function not working

Hi,

Try like this

Dimension : Store

Expression: =if (sum () = sum () , Your expression goes here)

Hope this helps you.

Regards,

Jagan.

Highlighted Specialist

## Re: Calculated Dimension using sum() function not working

Hi

Try like this

=Sum(If(FieldA=FieldB,Store))

Highlighted MVP

## Re: Calculated Dimension using sum() function not working

Hi Stefan,

1. First way is use calculated dimension for this table

[
A,B,store,Value
10,10,A,2346
20,20,B,2435
30,30,C,5689
]
;

Dim:- =if (sum (TOTAL ) = sum (TOTAL ) , store)

Expre:- Sum(Value)

2. Second way is use this condition in the expression part

Dim:- store

Expre:-  =if (sum (TOTAL ) = sum (TOTAL ) , Sum(Value),0)

Regards

Anand

Highlighted Creator

## Re: Calculated Dimension using sum() function not working

Hi everyone, so I found a solution.

Instead of using a calculated dimension, I just changed my expressions to the following:

=if(sum() = sum() ,  sum())

this expression says: if the sum of A equals to the sum of B, give the sum of A..

using this method, my straight table shows all Stores where A = B Thanks for the feedback guys, you're all brilliant!