Hello @nebadi, welcome to the QuickSight community!
We can definitely make some updates to the calculated fields and hopefully fix some of the formatting/display issues in the visuals. The one thing I will point out though, is there are definitely limitations to the types of sorting that will be allowed in pivot tables. Even when it displays the option to sort based on the values (not columns or rows), it doesn’t actually change the display. If you want to be able to sort by the values field, I would recommend utilizing a standard table rather than a pivot table.
As for your calculations, I think we would want to alter both of the calculations to be LAC-W rather than LAC-A so they will function better together.
One question I do have is, for the Max Appointment field, why are you wrapping it in a sum function? Do you want it to sum across all values displayed or sum the max by warehouse and how do you want the Process Trailers partitioned? A little more clarification will help me provide assistance.
Now, based on the information above, these are the current recommendations I’d give to fix the calculated fields:
Processed Trailers = distinctCountOver(ifelse({anchor_date} = {checkin_shift_date}, {inbound_ship_appointment_id}, NULL), [{warehouse_id}], PRE_AGG)
I set this to partition by warehouse_id, but you can add other partitions or remove them depending on your expected output.
Max Appointments = sumOver(maxOver({max_appointment_constraint}, [{warehouse_id},{appointment_type},{anchor_date},{Shift Name}], PRE_AGG), [{warehouse_id}], PRE_AGG)
If you are going to be using these bracketed partition fields in your calculated fields and nesting multiple fields together, I always recommend using LAC-W aggregations. They function really well together. Let me know if this helps!