Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
maxsheva
Creator II
Creator II

no identification for round brackets in csv

Hi All,

I have csv with a column where positive and negative values.

For negative format in csv uses round brackets e.g. (2.30)

QlikView doesn't identify it as minus. What is the best way to convert into negative like -2.30?

I think about replace or purge but probably QlikView has other standard solution for such issue?

Thanks

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution might be:

QlikCommunity_Thread_309312_Pic1.JPG

table1:

LOAD *,

    Num#(String,'0.##;(0.##)') as Number,

    Num(Num#(String,'0.##;(0.##)')) as Value

Inline [

    String

    2.20

    (2.30)

    2.4

    (2.5)

    3

    (4)

];

hope this helps

regards

Marco

View solution in original post

6 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

hello,

it would be useful if you provide sample data ;

supposing you field is named A, try this;

load

IF(left(A,1)='(',num(replace(Replace(A, '(' , ''),')' , ''))*-1,A)  as A

from ...

regards,

QlikView Qlik Sense consultant
maxsheva
Creator II
Creator II
Author

Hi Khalil,

Thanks for suggestion but I am looking for some basic/standard solution from QlikView.

Currently I am using simple expression If(Field<0,-purgechar(Field,'()'),Field)

vishsaggi
Champion III
Champion III

Did your expression giving any error? Why don't you just use like

= Purgechar(Field, '()') * -1

maxsheva
Creator II
Creator II
Author

Thanks @vishsaggi

My expression is working well.

If there no standard solution I will keep mine in script.

Thanks All.

MarcoWedel

Hi,

one solution might be:

QlikCommunity_Thread_309312_Pic1.JPG

table1:

LOAD *,

    Num#(String,'0.##;(0.##)') as Number,

    Num(Num#(String,'0.##;(0.##)')) as Value

Inline [

    String

    2.20

    (2.30)

    2.4

    (2.5)

    3

    (4)

];

hope this helps

regards

Marco

maxsheva
Creator II
Creator II
Author

Much appreciated Marco!

It is that what I expected to find.