Collapse Pivot Table row, Filter column, then expand row to show detail

ILOVEJAVA

New Member
Joined
Oct 25, 2018
Messages
1
Hi There,

This is my table and I need to compare prior period to current period for any location that has less than -40% change and greater than 50% over the prior period.
[TABLE="width: 322"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Emp ID[/TD]
[TD]Location[/TD]
[TD]hours[/TD]
[TD]period[/TD]
[/TR]
[TR]
[TD]653521[/TD]
[TD]A000101[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]653521[/TD]
[TD]A000101[/TD]
[TD="align: right"]30.22[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]1115454[/TD]
[TD]A000101[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]1115454[/TD]
[TD]A000101[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]2514852[/TD]
[TD]A000101[/TD]
[TD="align: right"]23.12[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]2514852[/TD]
[TD]A000101[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]1458400[/TD]
[TD]A000101[/TD]
[TD="align: right"]66.8[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]1458400[/TD]
[TD]A024531[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]548408[/TD]
[TD]A024531[/TD]
[TD="align: right"]60[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]548408[/TD]
[TD]A024531[/TD]
[TD="align: right"]13.2[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]424014[/TD]
[TD]A024531[/TD]
[TD="align: right"]83.09[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]424014[/TD]
[TD]A024531[/TD]
[TD="align: right"]22.4[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]292967[/TD]
[TD]A024531[/TD]
[TD="align: right"]79.88[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]292967[/TD]
[TD]A024531[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]1820548[/TD]
[TD]A024531[/TD]
[TD="align: right"]120[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]1820548[/TD]
[TD]A024531[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]2568555[/TD]
[TD]A024531[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]2568555[/TD]
[TD]A024531[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]484996[/TD]
[TD]A024531[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]484996[/TD]
[TD]A024531[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]545567[/TD]
[TD]A024531[/TD]
[TD="align: right"]14.08[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]545567[/TD]
[TD]A006471[/TD]
[TD="align: right"]35.1[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]2468050[/TD]
[TD]A008805[/TD]
[TD="align: right"]42[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]2468050[/TD]
[TD]A008805[/TD]
[TD="align: right"]61.45[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]98443[/TD]
[TD]A008805[/TD]
[TD="align: right"]11.5[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]98443[/TD]
[TD]A008320[/TD]
[TD="align: right"]11.5[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]386793[/TD]
[TD]A022553[/TD]
[TD="align: right"]10.65[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]386793[/TD]
[TD]A022553[/TD]
[TD="align: right"]38.65[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]2850342[/TD]
[TD]A022553[/TD]
[TD="align: right"]41.9[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]2850342[/TD]
[TD]A022553[/TD]
[TD="align: right"]38[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]2282629[/TD]
[TD]A022553[/TD]
[TD="align: right"]45.9[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]2282629[/TD]
[TD]A022553[/TD]
[TD="align: right"]12.4[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]324737[/TD]
[TD]A022553[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]324737[/TD]
[TD]A022553[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]562941[/TD]
[TD]A000986[/TD]
[TD="align: right"]78.4[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]562941[/TD]
[TD]A000986[/TD]
[TD="align: right"]83.05[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]1108451[/TD]
[TD]A006471[/TD]
[TD="align: right"]58.2[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]1108451[/TD]
[TD]A006471[/TD]
[TD="align: right"]51.6[/TD]
[TD="align: right"]201821[/TD]
[/TR]
[TR]
[TD]1125932[/TD]
[TD]A006471[/TD]
[TD="align: right"]18.15[/TD]
[TD="align: right"]201822[/TD]
[/TR]
[TR]
[TD]1125932[/TD]
[TD]A006471[/TD]
[TD="align: right"]24.7[/TD]
[TD="align: right"]201821[/TD]
[/TR]
</tbody>[/TABLE]

I created a pivot table and added a filter for <-40% and >50%. I need to collapse the data and look at locations that <-40% and >50% change over prior period, then I need to show detail under the filtered locations.

[TABLE="width: 741"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD]Column Labels[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]201821[/TD]
[TD][/TD]
[TD="align: right"]201822[/TD]
[TD][/TD]
[TD]Total Sum of hours[/TD]
[TD]Total Sum of hours2[/TD]
[/TR]
[TR]
[TD]Row Labels[/TD]
[TD]Sum of hours[/TD]
[TD]Sum of hours2[/TD]
[TD]Sum of hours[/TD]
[TD]Sum of hours2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A000101[/TD]
[TD="align: right"]249.92[/TD]
[TD][/TD]
[TD="align: right"]125.22[/TD]
[TD="align: right"]-49.90%[/TD]
[TD="align: right"]375.14[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]653521[/TD]
[TD="align: right"]80[/TD]
[TD][/TD]
[TD="align: right"]30.22[/TD]
[TD="align: right"]-62.23%[/TD]
[TD="align: right"]110.22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1115454[/TD]
[TD="align: right"]80[/TD]
[TD][/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]-81.25%[/TD]
[TD="align: right"]95[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2514852[/TD]
[TD="align: right"]23.12[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]246.02%[/TD]
[TD="align: right"]103.12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1458400[/TD]
[TD="align: right"]66.8[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]#NULL![/TD]
[TD="align: right"]66.8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A000986[/TD]
[TD="align: right"]83.05[/TD]
[TD][/TD]
[TD="align: right"]78.4[/TD]
[TD="align: right"]-5.60%[/TD]
[TD="align: right"]161.45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]562941[/TD]
[TD="align: right"]83.05[/TD]
[TD][/TD]
[TD="align: right"]78.4[/TD]
[TD="align: right"]-5.60%[/TD]
[TD="align: right"]161.45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A006471[/TD]
[TD="align: right"]76.3[/TD]
[TD][/TD]
[TD="align: right"]111.45[/TD]
[TD="align: right"]46.07%[/TD]
[TD="align: right"]187.75[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]545567[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]35.1[/TD]
[TD][/TD]
[TD="align: right"]35.1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1108451[/TD]
[TD="align: right"]51.6[/TD]
[TD][/TD]
[TD="align: right"]58.2[/TD]
[TD="align: right"]12.79%[/TD]
[TD="align: right"]109.8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1125932[/TD]
[TD="align: right"]24.7[/TD]
[TD][/TD]
[TD="align: right"]18.15[/TD]
[TD="align: right"]-26.52%[/TD]
[TD="align: right"]42.85[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A008320[/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]#NULL![/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]98443[/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]#NULL![/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A008805[/TD]
[TD="align: right"]42[/TD]
[TD][/TD]
[TD="align: right"]72.95[/TD]
[TD="align: right"]73.69%[/TD]
[TD="align: right"]114.95[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2468050[/TD]
[TD="align: right"]42[/TD]
[TD][/TD]
[TD="align: right"]61.45[/TD]
[TD="align: right"]46.31%[/TD]
[TD="align: right"]103.45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]98443[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[TD="align: right"]11.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A022553[/TD]
[TD="align: right"]129.05[/TD]
[TD][/TD]
[TD="align: right"]178.45[/TD]
[TD="align: right"]38.28%[/TD]
[TD="align: right"]307.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]386793[/TD]
[TD="align: right"]38.65[/TD]
[TD][/TD]
[TD="align: right"]10.65[/TD]
[TD="align: right"]-72.45%[/TD]
[TD="align: right"]49.3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2850342[/TD]
[TD="align: right"]38[/TD]
[TD][/TD]
[TD="align: right"]41.9[/TD]
[TD="align: right"]10.26%[/TD]
[TD="align: right"]79.9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2282629[/TD]
[TD="align: right"]12.4[/TD]
[TD][/TD]
[TD="align: right"]45.9[/TD]
[TD="align: right"]270.16%[/TD]
[TD="align: right"]58.3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]324737[/TD]
[TD="align: right"]40[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]100.00%[/TD]
[TD="align: right"]120[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A024531[/TD]
[TD="align: right"]451.05[/TD]
[TD][/TD]
[TD="align: right"]189.6[/TD]
[TD="align: right"]-57.96%[/TD]
[TD="align: right"]640.65[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1458400[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]15[/TD]
[TD][/TD]
[TD="align: right"]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]548408[/TD]
[TD="align: right"]60[/TD]
[TD][/TD]
[TD="align: right"]13.2[/TD]
[TD="align: right"]-78.00%[/TD]
[TD="align: right"]73.2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]424014[/TD]
[TD="align: right"]83.09[/TD]
[TD][/TD]
[TD="align: right"]22.4[/TD]
[TD="align: right"]-73.04%[/TD]
[TD="align: right"]105.49[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]292967[/TD]
[TD="align: right"]79.88[/TD]
[TD][/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]-87.48%[/TD]
[TD="align: right"]89.88[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1820548[/TD]
[TD="align: right"]120[/TD]
[TD][/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]-66.67%[/TD]
[TD="align: right"]160[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2568555[/TD]
[TD="align: right"]80[/TD]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]-88.75%[/TD]
[TD="align: right"]89[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]484996[/TD]
[TD="align: right"]14[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]471.43%[/TD]
[TD="align: right"]94[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]545567[/TD]
[TD="align: right"]14.08[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: center"]#NULL![/TD]
[TD="align: right"]14.08[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD="align: right"]1042.87[/TD]
[TD][/TD]
[TD="align: right"]756.07[/TD]
[TD="align: right"]-27.50%[/TD]
[TD="align: right"]1798.94[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

My data is upwards of 400 locations and 30,000 unique employees. This will need to be done each change in period, so weekly. I am in the process of recording a macro, so I hope it is a solution that I can record a macro for.

Any assistance you are able to provide is greatly appreciated. I look forward to your response.

Thank you,

ILOVEJAVA
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top