Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I refer to a calculated dimension inside an expression for a straight table

Hi,

I am trying to a create a straight table as follows from 5 fields(FIELD1-FIELD5-).

dim1, calcdim2, expr1, expr2,exp3

dim1 = FIELD1

calcdim2 is a calculated dimension = if(aggr(avg(FIELD3)/sum(FIELD4), FIELD1, FIELD2), 'ABC', 'DEF')

expr1 = sum(aggr(sum(FIELD3 + FIELD4+ FIELD5) , FIELD1, calcdim2))

expr2 = avg(aggr(avg(FIELD5), FIELD1, calcdim2))

expr3 = column(1)/column(2)

The calcdim is calculated with any issues. I am however unable to use calcdim2 in expr1 and expr2.

There is a high probability that the calculation of calcdim2 will change frequently and also many more such dimensions will have to be calculated. Hence I don' t want to push these calculations to the load script.

I Have attached a test qvw.

Could someone help me come up with an elegant solution to this problem?

Regards,

IJK

2 Replies
Nicole-Smith

You could store the calculation in a variable, then call the variable in your expressions.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Generally you have to include the calculated dimension in full inside the expression to get the result. As suggested in the previous post one way to achieve that is to store the expression in a variable.

You do not want to store the result of the calculation as the the variable is calculated before the chart is built. So the expression should not start with =.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein