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

Graph Dimension expression - using Variable

Hi All

I have an issue producing a dimension in a graph. the result comes up with ' - ' as the dimension instead of '50%' , '40%' or '30%'

Here is the dimension i have for the x axis of my graph.

=if($(vDiff%)

<=0.5,'50%',

  if($(vDiff%)<=0.4,'40%',

   if($(vDiff%)<=0.3,'30%')

below is the variable in the expression. I have aggregated by 'Riskno' as this is necessary.

 

aggr

(if(Rank_1='ecar'or Rank_1='eCar' or Rank_1='asda OE' or Rank_1='Asda OE' or Rank_1='asda oe',
(
if(Rank_2='ecar'or Rank_2='eCar'or Rank_2='asda OE' or Rank_2='Asda OE' or Rank_2='asda oe',
(
Rank_1_Premium-Rank_3_Premium)/Rank_1_Premium,(Rank_1_Premium-Rank_2_Premium)/Rank_1_Premium)),
(-1*(
Rank_1_Premium-Min({$<Insurer_Us={'Us'}>} [Premium]))/Rank_1_Premium)),

Riskno)

Can anybody see where my problem lies? I appreciate your help

7 Replies
pennetzdorfer
Creator III
Creator III

Maybe the round function can help you ...?

=num(Round($(vDiff%),0.1),'0%')

Not applicable
Author

I'm happy the Dimension expression is correct as it is a replica of one i have used in a different graph.

i believe the issue to be with the Variable.

Regards

pennetzdorfer
Creator III
Creator III

Does it work, when you just put the variable as dimension? Could you post the definition for vDiff% ?

Not applicable
Author

The variable definition vDiff% is included in the original question above.

  

aggr

 

(if(Rank_1='ecar'or Rank_1='eCar' or Rank_1='asda OE' or Rank_1='Asda OE' or Rank_1='asda oe',
(
if(Rank_2='ecar'or Rank_2='eCar'or Rank_2='asda OE' or Rank_2='Asda OE' or Rank_2='asda oe',
(
Rank_1_Premium-Rank_3_Premium)/Rank_1_Premium,(Rank_1_Premium-Rank_2_Premium)/Rank_1_Premium)),
(-1*(
Rank_1_Premium-Min({$<Insurer_Us={'Us'}>} [Premium]))/Rank_1_Premium)),

Riskno)

pennetzdorfer
Creator III
Creator III

I'm not quite sure, but I think you can't use aggr() without having any aggregation functions inside (sum, count, max etc). Maybe adding sum() after aggr() may help you.

Can you post an example qvw?

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You did not close the brackets, or include an option for >50% in your dimension. I think you need:

=if($(vDiff%) <= 0.5, '50%',

if($(vDiff%) <= 0.4, '40%',

if($(vDiff%) <= 0.3, '30%', '>50%')))

Hope that helps

Jonathan

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

That in just an example. I did the bracket wrong in the example. My mistake.

The issue lies in the Variable i am sure of it. I just can't figure out the problem