New to QlikView

Discussion board where members can get started with QlikView.

Partner

Help with displaying whole numbers

Hi,

I have a straight table with an expression which basically just divides SALESQUANTITY by 3. I would like QLIKVIEW to only display the results for this expression if they are whole numbers, i.e.

If the results show

1.333

.333

4

2

.333

I only want the 4 and 2 to be displayed and the others hidden.

Is this possible?

8 Replies
Valued Contributor II

Help with displaying whole numbers

Try:

`If(SalesQuantity/3 = floor(SalesQuantity/3),SalesQuantity/3)`

Partner

Help with displaying whole numbers

That seems to have hidden everything...

any ideas?

Valued Contributor II

Help with displaying whole numbers

A cleaner version of the same would be:

if(frac(SalesQuantity/3)=0,SalesQuantity/3)

or

if(mod(SalesQuantity,3)=0,SalesQuantity/3)

Play around with the floor(), frac(), and mod() functions until you find something that works.

MVP & Luminary

Help with displaying whole numbers

HI,

Try this, it is working fine

I created a temp table like this

Test:

No, Sales
1, 466654.5
2, 53.45
3, 55
4, 44
5, 33
6, 85
7, 24.2
8, 24
];

and used the expression as below

if(Sales/3 = floor(Sales/3), Sales/3)

The straight table displays the No. 5 & 8 rows.

MVP & Luminary

Help with displaying whole numbers

Hi,

Mod() can take only integers as parameters. Instead you can go for fmod.

if(fmod(SalesQuantity, 3) = 0, SalesQuantity/3)

Regards,

Jagan.

Partner

AW:Re: Help with displaying whole numbers

Hi,

mod(Sales,3) is here the best way, and yes, 3 is an integer, Sales must not be an integer!

Partner

AW:Re: Help with displaying whole numbers

Sorry, i think i understand why this isn't working for me, it needs to be the sum of sales quantity, not just sales quantity.

How would i do this?

Highlighted
Not applicable

AW:Re: Help with displaying whole numbers

You could you this

if ( mod ( Sales ,1) = 0 , Sales, '')