Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mikegrattan
Creator III
Creator III

Division of variables returns the value of the numerator

I am trying to divide picked orders load time per pallet by non-picked orders load time per pallet to get a ratio.

First variable vTimeToLoad_Avg_Pick:  Avg({<PickFlag={1}>} MinutesToLoad)

Second variable vPalletsPerOrder_Pick:  Avg(Aggr(Avg({<PickFlag={1}>} DailyPallets), SalesOrder))

Resulting variable calc vMinToLoadPerPallet_Avg_Pick:  $(vTimeToLoad_Avg_Pick) / $(vPalletsPerOrder_Pick)

This results in a value of 9.12 minutes to load per pallet for a picked order.

For nonpick orders the math is the same, but the value of the PickFlag is changed to 0.  The result is a value of 6.36 minutes per pallet to load non-picked orders.

The result of dividing vMinToLoadPerPallet_Avg_Pick / vMinToLoadPerPallet_Avg_NonPick should be the result of dividing 9.12 by 6.36 which would equal 1.43.  However, I'm getting a result of 9.12.  I've tried putting parentheses around each variable, but then I get a result of Null ("-").  I've tried with and without $ and parens like this:


$(vMinToLoadPerPallet_Avg_Pick) / $(vMinToLoadPerPallet_Avg_NonPick)


and I get null result for that as well.


I also tried using the Div function and also got similar results.


Anything else I can try?


1 Solution

Accepted Solutions
aarkay29
Specialist
Specialist

you can use  Column(1)/Column(2) for ratio

View solution in original post

11 Replies
aarkay29
Specialist
Specialist

Could you be able to share the app ??

mikegrattan
Creator III
Creator III
Author

I have attached a copy of the app.  Please feel free to take a look.  Thank you.

aarkay29
Specialist
Specialist

Add '=' sign to the variable exp

vMinToLoadPerPallet_Avg_Pick=$(vTimeToLoad_Avg_Pick) / $(vPalletsPerOrder_Pick)

vMinToLoadPerPallet_Avg_NonPick: =$(vTimeToLoad_Avg_NonPick) / $(vPalletsPerOrder_NonPick)

and Use this exp vMinToLoadPerPallet_Avg_Pick / vMinToLoadPerPallet_Avg_NonPick

mikegrattan
Creator III
Creator III
Author

I added the = sign to both pick and nonpick formulas and I'm now getting the ratio result, which is a step forward.  Unfortunately, my calcs are now showing the same result for all years and all warehouses.  If you can take a look at the pivot table "Average Time to Load Per Pallet" on the sheet "Load Time factors - Pick vs Non-Pick" perhaps you can see what I mean.

Thank you for your assistance.

aarkay29
Specialist
Specialist

Seems to be working for me

PFA with new sheet

mikegrattan
Creator III
Creator III
Author

Using a pivot table I am seeing the numbers duplicate for all years and all warehouses.

aarkay29
Specialist
Specialist

Sorry

Remove the '=' sign for variables

and try using this exp

$(=$(vMinToLoadPerPallet_Avg_Pick))

/

$(=$(vMinToLoadPerPallet_Avg_NonPick))

mikegrattan
Creator III
Creator III
Author

That fixed the Pick and NonPick numbers in the pivot table, but the ratio calc is coming up 1.55 for every combination of year and warehouse...strangely.

MinToLoadPerPallet.jpg

mikegrattan
Creator III
Creator III
Author

I've tried various combinations of using the = sign for formulas/variables and still coming up with strange results.  Any other ideas?