Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

replace

how to replace the '<=x<' symbol with '-' function using replace function?

15 Replies
Not applicable
Author

its not working

new:

LOAD Region,

     Year,

     Products,

     Sales,

class

     ([Sales],30) as Salesrange

   

     

FROM

(biff, embedded labels, table is Sheet1$);

A:

    LOAD * ,  Replace(Salesrange,'<=x <' ,'-') as Sales_Range

   

      Resident new;

   

      DROP Table new;

MarcoWedel

Dual(Replace(Class(Sales,30),'<= x <','-'),Class(Sales,30)) as Salesrange

SunilChauhan
Champion II
Champion II

Replace(Salesrange,'<=x <' ,'-')

seems there is space in between x and <


use below

Replace(Salesrange,'<=x <' ,'-') as Sales_Range


Sunil Chauhan
MarcoWedel

Hi,

replacing the '<= x <' string using replace() is only one thing, because doing so you will get just a string, not a dual value like the class function generates. i.e. you would have to implement sorting expressions in charts to get the right order of you class dimension.

To avoid this issue, one solution could be:

QlikCommunity_Thread_140135_Pic1.JPG.jpg

QlikCommunity_Thread_140135_Pic2.JPG.jpg

tabSales:

LOAD *,

    Dual(Replace(Class(Sales,30),'<= x <','-'),Class(Sales,30)) as Salesrange;

LOAD 'Region'&Ceil(Rand()*10) as Region,

    2000+Floor(Rand()*15) as Year,

    'Product'&Ceil(Rand()*10) as Products,

    Money(Round(Rand()*300,0.01)) as Sales

AutoGenerate 100;

hope this helps

regards

Marco

MarcoWedel

Hi,

did any of the proposed solutions answer your question?

regards

Marco

Not applicable
Author

yes thank macro