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: 
PWJ67
Contributor II
Contributor II

Converting a character to numer with set analysis expression

Hi, 

I have to convert STATLIB2 wich is a character to number within a set analysis expression.

I've tried several things like this :

=sum({$<STATLIB2={">=2010"}>} STATVAL)
=sum({$<"$(num#(STATLIB2))"={">=2010"}>} STATVAL)

Any idea ?

PS : The final expression will have to calculate too the last ten year , yead(today())-10 , with the set expression

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

As below, you don't need Dollar Expansion

 

=sum({<"=Num#(STATLIB2)"={">=2010"}>} STATVAL)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

4 Replies
KGalloway
Creator II
Creator II

Is the STATLIB2 field always a number? If so, it would be more effective to convert it to a number in the load script. Then when working in a chart, it will already be a number.

You may also consider using an if statement rather than set analysis.

For example, sum(if(isnum(STATLIB2) and STATLIB2 >= 2010, STATVAL)) will find the sum of STATVAL values but only sums records where the two conditions are met.

PWJ67
Contributor II
Contributor II
Author

Hi Gallo and thanks for help.

But STATLIB2 can be a character or a number, and I try to find the syntax with set analysis. It's more an exercice then a real problem. 😁

vinieme12
Champion III
Champion III

As below, you don't need Dollar Expansion

 

=sum({<"=Num#(STATLIB2)"={">=2010"}>} STATVAL)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
PWJ67
Contributor II
Contributor II
Author

So easy and simple ... thanks a lot Vineeth.