Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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!

1 Solution

Accepted Solutions
Not applicable
Author

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...

View solution in original post

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

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

Not applicable
Author

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...

its_anandrjs

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

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Dimension : Store

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

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable
Author

Hi

Try like this

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

its_anandrjs

Hi Stefan,

1. First way is use calculated dimension for this table


LOAD * Inline
[
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




Anonymous
Not applicable
Author

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!