9 Replies Latest reply: Dec 5, 2016 3:06 PM by sahil thakur

# Display whole no. without decimal

Hi Everyone,

I am new to Qlik, need your help. i want  my data as:

if my answer is a whole number then it will be as ## only, there should not be any decimal point

but if it is a fractional number the digit after decimal point should appear.

for eg 12/3=4

and 12/5= 2.4

it should appear like this.

can u pls help me?

• ###### Re: Display whole no. without decimal

How many decimal Points? If it can be unlimited, then a regular division would do just that

• ###### Re: Display whole no. without decimal

Actually i want decimal point only when required, denominator is variable so either i will get whole no or floating point no. in case of whole no i dont want decimal point, in case of floating point i want two digits after decimal point

• ###### Re: Display whole no. without decimal

=num(

sum(

{<prd_id -= {'Daily'}, TCD_Effort -= {''} >}  TCD_Complexity

)

/

(

sum(

{<prd_id -= {'Daily'}>}TCD_Effort)

/

8

)

,'###.##')

This is my code, now i if answer is whole number i don't want it as 3.00, i want it as 3 alone, from the same expression if i get floating point value then i want it as 3.02 or whatever the value is

• ###### Re: Display whole no. without decimal

May be try this:

If(Frac(Sum({<prd_id -= {'Daily'}, TCD_Effort -= {''} >}  TCD_Complexity)/(Sum({<prd_id -= {'Daily'}>}TCD_Effort)/8)) = 0, Num(Sum({<prd_id -= {'Daily'}, TCD_Effort -= {''} >}  TCD_Complexity)/(Sum({<prd_id -= {'Daily'}>}TCD_Effort)/8), '###'), Num(Sum({<prd_id -= {'Daily'}, TCD_Effort -= {''} >}  TCD_Complexity)/(Sum({<prd_id -= {'Daily'}>}TCD_Effort)/8), '###.##'))

• ###### Re: Display whole no. without decimal

I tried but it is not working.

isqlikview, is there is any statement which performs the same function?

• ###### Re: Display whole no. without decimal

Really? Would you be able to share a sample where this isn't working? I might have missed a parenthesis or something because all I am doing is this

If(Frac(Expression) = 0 (has no value after decimal), then use Num(Expression, '###'), otherwise use Num(Expression, ###.##)

Can you check if Num(Expression, '###') works? If it doesn't, then try with Num(Expression, '##') or Num(Expression, '##.')

Once you know what is working stand alone, bring that into your true part of the if condition.

• ###### Re: Display whole no. without decimal

Thanks buddy...It helped a lot.

• ###### Re: Display whole no. without decimal

So what was the final expression that you ended up using?

• ###### Re: Display whole no. without decimal

The second expression u shared.. i.e.

If(Frac(Expression) = 0 (has no value after decimal), then use Num(Expression, '###'), otherwise use Num(Expression, ###.##)

This helped alot... thanks once again