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: 
Not applicable

Can we use Variables in Class Function?

I have 3 Variables defined as follows

vMinChargedAmount    Min(CHARGED_AMOUNT)

vMaxChargedAmount   Max(CHARGED_AMOUNT)

vChargedAmountWidth  ($(vMaxChargedAmount) - $(vMinChargedAmount))/10

I am creating a bar chart with dimension as follows

=Class(CHARGED_AMOUNT,$(vChargedAmountWidth))

Expression

Count (DISTINCT CHARGED_AMOUNT)

Basically I am trying to calculate the Class width through variable. If I hardcode value it works. But when I use variables I am getting error

See the attached file for Screens (Manual_Definition.PNG: OK, Variable_Calculated.PNG Not OK)

What is the mistake I am making?

Thank you

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you need to force the variables to be a single calculation. Add  an "=" to your variable value defintion. That will result in the the calculated number being substituted in the class() function instead of the expression.

-Rob

http://robwunderlich.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you need to force the variables to be a single calculation. Add  an "=" to your variable value defintion. That will result in the the calculated number being substituted in the class() function instead of the expression.

-Rob

http://robwunderlich.com

Not applicable
Author

Thank you Rob Wunderlich. Appreciate your help