Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Calculated Dimension

I am trying to use the following statement =if(Sum ([Bill Hrs]) / Sum ([Std Hrs]) <= vMax, [Equipment Desc]) to calculate a dimension, however I am getting the message '// Error in calculated dimension" . Are you not allowed to do a sum within a calculated dimension or is my format wrong. vMax is a percentage from a slider. Thanks



1 Solution

Accepted Solutions
johnw
Champion III
Champion III

You aren't allowed to do a sum() or other aggregations in a calculated dimension without using the aggr() function. In this case, I assume you want the sums to be in the context of the given piece of equipment? Then I would think you'd do this:

if(aggr(sum([Bill Hrs]),[Equipment Desc])
/aggr(sum( [Std Hrs]),[Equipment Desc]) <= $(vMax),[Equipment Desc])

I'm actually not sure if I have the aggr() in the right place, but you need an aggr().

View solution in original post

9 Replies
Not applicable

If vMax is a variable you added, try $(vMax) instead.

tmumaw
Specialist II
Specialist II
Author

All ready tried that one....same results.

Thanks

Not applicable

Could it be there are multiple selections possible for field [Equipment Desc]?

Try a Min, Max, Count, ... for that field.

I tried several versions of your instruction in the "What's New in QV9" application and they all worked. So I am just guessing atm 😉

tmumaw
Specialist II
Specialist II
Author

We are on 8.5,

tmumaw
Specialist II
Specialist II
Author

There can be multiple equipment descriptions

johnw
Champion III
Champion III

You aren't allowed to do a sum() or other aggregations in a calculated dimension without using the aggr() function. In this case, I assume you want the sums to be in the context of the given piece of equipment? Then I would think you'd do this:

if(aggr(sum([Bill Hrs]),[Equipment Desc])
/aggr(sum( [Std Hrs]),[Equipment Desc]) <= $(vMax),[Equipment Desc])

I'm actually not sure if I have the aggr() in the right place, but you need an aggr().

Not applicable

Embarrassed ahum ... I should have realized that, just studied the aggr() function yesterday.

Look in the help for an explanation on aggr(). It will really help in realizing why and how when using aggr() Smile

tmumaw
Specialist II
Specialist II
Author

John,

You are a officer and a gentleman. Thanks for all your help that is exactly what needed done. Where do I send the six-pack.

Thom

tmumaw
Specialist II
Specialist II
Author

Mark,

Thanks for your help. See if John wants to share the six-pack.

Thom