Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
We value your feedback – take our 5-minute QlikView modernization survey
cancel
Showing results for 
Search instead for 
Did you mean: 
trishita
Creator III
Creator III

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
Master
Master

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

View solution in original post

11 Replies
vvira1316
Specialist II
Specialist II

shiveshsingh
Master
Master

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
Creator III
Creator III
Author

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
Master
Master

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

trishita
Creator III
Creator III
Author

I tried but its not working

shiveshsingh
Master
Master

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


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


Are you trying like this?

trishita
Creator III
Creator III
Author

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
Master
Master

i misunderstood the query first.

please try this

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


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

shiveshsingh
Master
Master

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,',','.'),'##.###')