Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have some data that has been created using SUM (). Some of it is integer, some of it is not. I would like integers displayed without decimal places. But I would like the data that contains decimal places to stop at 2 dp. e.g. Data of
1
2
3.45678
would display as
1
2
3.46
If I just display the data, I get
1
2
3.45678
If I use the NUM function (ie NUM (<field>, '#,##'), I get
1.00
2.00
3.46
Does anyone know what I am doing wrong with NUM ? My understanding was that the use of the hash meant the decimal places were flexible and would not appear if they weren't there but they are appearing.
NUM (<field>, '#,##') , This format works, but don't set any number setting (dont override document settings)on the chart for this field.
My recommendation is to avoid using text function like Subfield(), since text operations are significantly slower in performance than numerical operations.
With Frac() it is possible to remove the integer part from a value, and if the decimal part is not 0 then the value is a decimal value and should be rounded.
Notice that Round() will adapt both the visible value and the underlying value, while Num() will keep the underlying decimal value and just adapt the visual value. So the selected function to adapt the value depends on what precision you want to have on calculations.
LOAD
If(Frac(F1)<>0,Round(F1,'0.01'),F1) AS F1
Inline [
F1
1
2
3.45678
];
Hi,
Try this,
=if(len(fmod(field,10))>1,num(field,'##.##'),num(field,''))
Regards,
Otherwise you can simply try with
Num(YourFieldHere,'##.##') as NewNum;