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 can i make a expression with a pieces of one string?

Hy boddies,

I have a excel file where i have a field with a description for my calcule

example:

FIELD: CRITICO
Value: <=88,89%

and i have a dynamic chart and i need change the background based with this field...

i made a expression: = IF(NUM(VALOR) & MID(CRITICO,1,2) & NUM(TRIM(MID(CRITICO,3))),RED())

VALOR and CRITICO are my dimensions!

where the results are 0,8926<=0,8889

but the qlikview understand that like a string instead of an expression and doesn´t work...

anyone have some idea how can i make that???

tks a lot!!!

1 Solution

Accepted Solutions
pover
Partner - Master
Partner - Master

Aaah, now I understand. Ok, make 2 variables: one as =mid(CRITICO,1,2) and the second as =num(trim(mid(CRITICO,3))). Then in your formula in the background put

if(num(VALOR) $(Variable_1) $(Variable_2),Red())

Regards.

View solution in original post

6 Replies
pover
Partner - Master
Partner - Master

Where are you defining this expression?

Start the expression with a = and make sure there is no space before the =. It should be the very first character.

Regards.

Edit: Rereading your post and looking at you if statement more closely, I think I misunderstood your problem. The problem is that the value in the condition is a string and not a number? I don't under the condition in the if statement. You want to concatenate numbers?

Not applicable
Author

Karl,

I defined on expression -> background

i started with =...and dont have spaces...

My problem is a classification of values came from excel file like string, and i need break in two parts to make my expression.

Tks!!!

pover
Partner - Master
Partner - Master

Érico,

I don't understand completely the condition in the if statement:

NUM(VALOR) & MID(CRITICO,1,2) & NUM(TRIM(MID(CRITICO,3)))

This can evaluate to 0 or 1 or true or false or where is the comparison with 0,8889? Can you put an example of the data for VALOR and CRITICO?

Regards.

Not applicable
Author

Karl,

Num(Valor) can be 0,8799

and Critico can be <=88,89%

with my expression i want make this:



expression: IF(NUM#(VALOR,'#.##0,000') & MID(CRITICO,1,2) & NUM#(TRIM(MID(CRITICO,3)),'#.##0,000'),RED())
NUM(VALOR) = 0,8799
MID(CRITICO,1,2) = <=
NUM(TRIM(MID(CRITICO,3))) = 0,889
Results: IF(0,8799 <= 0,889 , RED() )

But i think the QV don´t understand this ( MID(CRITICO,1,2) = <= ), understanding like string and not operator.

Is confuse to explain......sorry....do you understand my problem now?

pover
Partner - Master
Partner - Master

Aaah, now I understand. Ok, make 2 variables: one as =mid(CRITICO,1,2) and the second as =num(trim(mid(CRITICO,3))). Then in your formula in the background put

if(num(VALOR) $(Variable_1) $(Variable_2),Red())

Regards.

Not applicable
Author

Tks a lot.....i solve this problem with some IFs.....lololol......

....but your idea work pretty well...

tks for your attention!!!!!