Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

trishita
Contributor

how to get decimal value of a field

Load


FUEL_MASS_AFTER_SOUNDING,
FUEL_MASS_BEFORE_SOUNDING,
(
FUEL_MASS_AFTER_SOUNDING-FUEL_MASS_BEFORE_SOUNDING) AS DEVIATION_AFTER_SOUNDING,
FUEL_TYPE,
IMO_NUMBER AS IMO_NO,

FROM
[mo_purch_sounding_correction_view.qvd]
(
qvd);

The DEVIATION_AFTER_SOUNDING field shows value as -42000 but I want to see it in decimal -42.608 format.

How to convert this field into decimal?

1 Solution

Accepted Solutions
shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

ohk, got it, then you can use num() and define the format inside the brackets

11 Replies
vvira1316
Valued Contributor II

Re: how to get decimal value of a field

shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

Hi

What's the logic of changing it to decimal? Can you share the qvd to check what's the data type?

or try this

Num( DEVIATION_AFTER_SOUNDING/ 1000, ' ###.##', '.', ',' )

trishita
Contributor

Re: how to get decimal value of a field

I have two fields from two different databases .the field is common in both databases

I want the both to have same format.

DEVIATION_AFTER_SOUNDING has data like -42.000 (means 42k  and . denotes thousand)

Diff vs Log survey has   -42,608 (where , is decimal)

I want that both has same data-format because later I will use them to compare fields

shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

ohk, got it, then you can use num() and define the format inside the brackets

trishita
Contributor

Re: how to get decimal value of a field

I tried but its not working

shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

num(DEVIATION_AFTER_SOUNDING ,'##.###')


num(Diff vs Log survey,'##.###')


Are you trying like this?

trishita
Contributor

Re: how to get decimal value of a field

Num( SoundingCorrections.DEVIATION_AFTER_SOUNDING/ 1000, ' ###,###', ',', '.' )

I used it in the edit expression field but it s still showing the same kind of data

shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

i misunderstood the query first.

please try this

num(DEVIATION_AFTER_SOUNDING ,'##.###')


num(Diff vs Log survey,'##.###')

shiveshsingh
Honored Contributor

Re: how to get decimal value of a field

and for Diff vs Log survey, if there is comma in place of dot, first replace it with dot and then perform num..

=num(Replace(Diff vs Log survey,',','.'),'##.###')

Community Browser