Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

what is wrong with QlikView?

Hello
Check attached sample QVW (reduced)
I have a column called balance_quantity_puom

I see it that it has the value of 5

My expression is as follows:
div($(vInventory_Qty_Balance),Only({<document_status,trx_type="inventory_balances"},trx_date=$(=max(trx_date))}>}product_unit_per_pack))

$(vInventory_Qty_Balance) gives 5
and 
Only({<document_status,trx_type="inventory_balances"},trx_date=$(=max(trx_date))}>}product_unit_per_pack) gives 1

why I'm getting 4 instead of 5?

is this a bug in QlikView????

I can walk on water when it freezes
3 Replies
sunny_talwar

Seems like something related to rounding... this works

=div(
Round($(vInventory_Qty_Balance)),
Round(Only({<document_status,trx_type={"inventory_balances"},trx_date={$(=max(trx_date))}>}product_unit_per_pack))
)
ali_hijazi
Partner - Master II
Partner - Master II
Author

the thing is that I want to display in the table quantity as CASES \ EACH
for example:
if a product has 2 EA in a CASE and the Quantity is 13 EA then I should display 6\1 i.e. 6 cases and 1 EA
and sometimes the quantity is negative
13/2 is 6.5 so if I use round I will get 7 whereas I want the 6 cases \ 1

 

I can walk on water when it freezes
sunny_talwar

I am not rounding the resulting number

Round(div(13, 2))

I am rounding the numbers before we use div

div(Round(13), Round(2))

I don't think you will get 7 for the second one... have you tried it unsuccessfully?