# Why Sorting function is not working in Pivot table?

**URL:** <https://community.amazonquick.com/t/why-sorting-function-is-not-working-in-pivot-table/2585>\
**Category:** Q&A\
**Tags:** analysis, formatting, quick-sight\
**Created:** [March 25, 2022, 12:36am UTC](https://community.amazonquick.com/t/why-sorting-function-is-not-working-in-pivot-table/2585 "2022-03-25T00:36:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Jesse](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/jesse/32/177_2.png) [@Jesse](https://community.amazonquick.com/u/Jesse)\
**Post date:** [March 28, 2022, 11:50pm UTC](https://community.amazonquick.com/t/why-sorting-function-is-not-working-in-pivot-table/2585/5 "2022-03-28T23:50:08Z")

</div>

“Does it mean if I click on the field wells for Mask\_Org and sort that by Total Fees, it will sort the column total of Week 2 and Week 3’s total fees?” – Correct

Yes some types of Table Calculations dont support subtotals/totals at this time (this looks like 2 nested table calcs)…

I might suggest doing the 3 columns (week 2, week 3 and diff) a different way. The only downside with this approach is the column headers would have to be generic (like ‘This week’, ‘Last Week’ rather than the specific week number).

> [@Period Over Period and Other Date Comparison Calculations (YoY, MoM, YTD, Rolling 90 days, etc)](https://community.amazonquick.com/t/period-over-period-and-other-date-comparison-calculations-yoy-mom-ytd-rolling-7-days-etc/564):
>
> Often you may want to create tables and other visuals which display multiple fields that are all ‘filtered’ to different date periods, as well as period-over-period fields. However we can’t use normal filters for this since filters get applied to all fields in the visual. Conceptually in this solution we are building the filters directly into the calculated field itself (using the ifelse logic), so that each field can have a different ‘filtered’ time period. You can then do whatever math you wan…

It would be really easy to sort if you do it that way, and the report will look better (wont have the empty Diff column for the first period)

---

_[View the full topic](https://community.amazonquick.com/t/why-sorting-function-is-not-working-in-pivot-table/2585)._
