question

Marian Cretu avatar image
0 Likes"
Marian Cretu asked Joerg Vogel edited

How to pivot a table

Hello guys,

I have a table with racks,pallets,sku and I want to find which rack contains the most pallets with sku = 1.

Please advise.

Thank you.pivot_table.fsm

FlexSim 19.1.2
flexsim 19.1.2
pivot-table.fsm (19.6 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel edited
Table.query("SELECT rack_name, sku, SUM(pallets) AS amnt FROM stock \
WHERE sku = 1 GROUP BY rack_name \
ORDER BY amnt DESC").cloneTo(Table("dump"));

I copied the query result into a table called "dump". You find the rack_name of the most counted pallets of sku = 1 in cell [1][1].

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.