Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Calculated Dimensions

Hi All,

I have a bar chart wich has a dimesions 'Product' and expression as Count(distinct ID) and label for this expression is "Counts"

I have to add a calculated Dimension to and show three buckets HIgh, Modareat and low , depending on the count .

for which iam trying to do the below add calculated dimension

Under Add Calculated Dimension:

=if(count(distinct ID )>=$(vPercentage) and if(count(distinct ID <=$(vPercentageThirty),'High'),

if(count(distinct ID )>=$(vPercentageThirty) and if(count(distinct ID <=$(vPercentageFourthy),'Moderate','LOW')

But this is not working .

Can someone suggest me what expression do i need to add ?

Thanks

1 Solution

Accepted Solutions
avinashelite

Sorry Typo error from my end ..try the below expression ...

=if(

AGGR( count(distinct ID ), Product)>=$(vPercentage) and AGGR( count(distinct ID) ,Product)<=$(vPercentageThirty),'High',

if( AGGR(count(distinct ID ),Product)>=$(vPercentageThirty) and AGGR( count(distinct ID ),Product)<=$(vPercentageFourthy),'Moderate','LOW'

)

)

View solution in original post

9 Replies
jagan
Luminary Alumni
Luminary Alumni

HI,

Try ValueList() - synthetic dimension for this instead of using Calculated dimension.  Check this links below

Missing Manual - ValueLoop() &amp; ValueList()

Use Case for ValueList Chart Function

Regards,

Jagan.

avinashelite

Try like this

=if(AGGR( count(distinct ID ), Product)>=$(vPercentage) and if(AGGR( count(distinct ID) ,Product)<=$(vPercentageThirty),'High'),

if( AGGR(count(distinct ID ),Product)>=$(vPercentageThirty) and if(AGGR( count(distinct ID ),Product)<=$(vPercentageFourthy),'Moderate','LOW')

Kushal_Chawda

try this

aggr(if(count(distinct ID )>='$(vPercentage)' and count(distinct ID) <='$(vPercentageThirty)','High',

if(count(distinct ID)>'$(vPercentageThirty)' and count(distinct ID) <='$(vPercentageFourthy)','Moderate','LOW')),Product)

smilingjohn
Specialist
Specialist
Author

Hi Avinash it is giving Error

Not applicable

Hi,

Can you share model data set so that the requirement is more clear.

Reshma.

Kushal_Chawda

Have you tried my expression?

avinashelite

Sorry Typo error from my end ..try the below expression ...

=if(

AGGR( count(distinct ID ), Product)>=$(vPercentage) and AGGR( count(distinct ID) ,Product)<=$(vPercentageThirty),'High',

if( AGGR(count(distinct ID ),Product)>=$(vPercentageThirty) and AGGR( count(distinct ID ),Product)<=$(vPercentageFourthy),'Moderate','LOW'

)

)

jonathandienst
Partner - Champion III
Partner - Champion III

I don't think you need an Aggr() expression, but I was not clear on the relationship between the levels and the two variables as your expression had syntax errors. Assuming the variables are values, then you don't need the expansions either. So if Low means the lowest count values, then perhaps you mean:

=If(count(distinct ID) < vPercentageThirty, Low

  If(count(distinct ID) < vPercentageFourthy, 'Moderate',

  'High'

  )

)

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

I think you are missing ')' in your expression [in the second part after 'and' count distinct ID...]:

=if(count(distinct ID )>=$(vPercentage) and if(count(distinct ID <=$(vPercentageThirty),'High'),

if(count(distinct ID )>=$(vPercentageThirty) and if(count(distinct ID <=$(vPercentageFourthy),'Moderate','LOW')