Pivot table filter

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I need to work out how many scores of 80 or more have been obtained by Course. In the sample data, Chem would have 2, English would have 1 etc. I can only do this through PTs if I filter the original data for scores 80 or more, copy to new sheet and then do a count. I'm thinking there must be a way within the original data setup with a PT that will allow for filtering. Tried Report filters and Calculated fields but couldn't get the desired output.
PT filter.xlsx
ABCDEF
1NameSubjectScoreScore(All)
2JackMaths84
3FredChem73Row LabelsCount of Score
4PeteEnglish89Chem4
5HarryFrench88English3
6MaryMaths60French3
7SallyChem62Maths4
8DonEnglish79Grand Total14
9KenFrench91
10EddieMaths70
11SaraChem92
12JoelEnglish75
13TomFrench88
14JakeMaths94
15NoelChem95
Sheet1
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
maybe
pt.png

or you can use Power Query then Pivot Table, up to you
 
Upvote 0
with Power Query
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Filter = Table.SelectRows(Source, each [Score] >= 80)
in
    Filter
pqpt.png
 
Upvote 0
Hi Sandy, thanks for your input. Your post no. 2 is what I tried but in the actual data there are hundreds of entries over 80 and I couldn't find a shortcut to select multiple entries.
Your PQ option is nice but I am trying to upskill someone who is comfortable with PTs, if possible I'd like to avoid introducing PQ until COVID 19 is under control until I can teach them more efficiently than in a remote environment.
If there's no easy way in PTs, it does make me wonder how people would do such an analysis before tools like PQ were available.
 
Upvote 0
You can use vba to create PT or choose a filter but I can't help with this
 
Upvote 0
You can use vba to create PT or choose a filter but I can't help with this
No problem, I don't really want to go down the VBA path but I guess it does show a limitation of PTs, they are very powerful but you sometimes need a workaround to get the desired result.
 
Upvote 0
You can also use extended Power Query with additional one-cell table to define your/user "filter"
Power Query:
   Filter = Table.SelectRows(Source, each [Score] >= defined_filter)
 
Upvote 0
You can also use extended Power Query with additional one-cell table to define your/user "filter"
Power Query:
   Filter = Table.SelectRows(Source, each [Score] >= defined_filter)
Thanks Sandy, what do you mean by extended PQ?
 
Upvote 0
Power Query:
let
    def = Excel.CurrentWorkbook(){[Name="Table2"]}[Content][Filter]{0},
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Filter = Table.SelectRows(Source, each [Score] >= def)
in
    Filter
FilterSubjectCount of Score
95Chem1
Grand Total1
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,178
Latest member
Emilou

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