Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Try:
If(SalesQuantity/3 = floor(SalesQuantity/3),SalesQuantity/3)
That seems to have hidden everything...
any ideas?
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.
HI,
Try this, it is working fine
I created a temp table like this
Test:
LOAD * INLINE [
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.
Hi,
Mod() can take only integers as parameters. Instead you can go for fmod.
if(fmod(SalesQuantity, 3) = 0, SalesQuantity/3)
Regards,
Jagan.
Hi,
mod(Sales,3) is here the best way, and yes, 3 is an integer, Sales must not be an integer!
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?
You could you this
if ( mod ( Sales ,1) = 0 , Sales, '')