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

Announcements
Congratulations to the new Qlik Luminary and Partner Ambassador class! Meet them here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Removing decimal

I want to take return all the digits before the FIRST decimal in a list.

I have

1920.1008.678

1800.786.894

So should return :

1920

1800

Thanks

Labels (1)
8 Replies
kaushiknsolanki
MVP
MVP

Hi,

You can try mid function as below.

=Mid('1920.1008.678',1,Index('1920.1008.678','.',1)-1) 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
sunny_talwar
MVP
MVP

Or may be this:

SubField(FieldName, '.', 1)

Not applicable
Author

I have a long list of such numbers not just the two examples mentioned. Also I have some with just one decimal such as

1820.898

kaushiknsolanki
MVP
MVP

Hi,

The Number is just an example, you will have field name instead of the value in your script.

So your expression will be

Load *,Mid(FieldName,1,Index(FieldName,'.',1)-1) as Number From xyx;

Or as Sunny said it will be

Load *,Subfield(FieldName,'.',1) as Number From xyx;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks both.

Sunny I tried your solution and whilst it does work, if there are two separate rows with the same value it only returns for one of them.

So if I have

1880.889.190

1880.889.190

it only returns 1880 for the first row and blank for the second

sunny_talwar
MVP
MVP

It must be returning both values, but just not showing it. Add a new field called RowNo() as Key and use that in your table box to see both the rows individually.

miguelbraga
Partner - Specialist III
Partner - Specialist III

Try simply this:

     left(Value, 4)

Should surfice you

Regrads,

MB

MarcoWedel
MVP
MVP

just for fun another one:

=TextBetween('\'&YourField,'\','.')