power query filter...

Urraco

Board Regular
Joined
Apr 19, 2021
Messages
69
Office Version
  1. 2016
Platform
  1. Windows
Hello everybody,

I combined 4 xlsx files with powerQ.
How could I generate a new filtered list like in the example on the right table ?
Thank you very much.

test.xlsx
ABCDEFGHI
1filenamenameCountnamefile1.xlsxfile2.xlsxfile3.xlsxfile4.xlsx
2file1.xlsxAdrain2Adrain214
3file1.xlsxMichael4Alexandra72929
4file1.xlsxAlexandra7Ana25
5file1.xlsxTheodor5
6file1.xlsxColeman3
7file1.xlsxBabriel8
8file1.xlsxRobert5
9file1.xlsxBlack4
10file2.xlsxPaul8
11file2.xlsxBlack11
12file2.xlsxColeman7
13file2.xlsxAdrain1
14file2.xlsxTerry6
15file2.xlsxMichael8
16file2.xlsxGal8
17file2.xlsxDragon12
18file2.xlsxAlexandra29
19file2.xlsxFlowers4
20file2.xlsxGreg6
21file2.xlsxAna2
22file2.xlsxAndreea4
23file3.xlsxDennis13
24file3.xlsxDean3
25file3.xlsxNed4
26file3.xlsxColeman2
27file3.xlsxPeter6
28file3.xlsxTheodor17
29file4.xlsxPaul9
30file4.xlsxBlack12
31file4.xlsxColeman7
32file4.xlsxBabriel8
33file4.xlsxRobert5
34file4.xlsxNed10
35file4.xlsxTerry1
36file4.xlsxAdrain4
37file4.xlsxMichael4
38file4.xlsxAlexandra29
39file4.xlsxAna5
40file4.xlsxSteven2
41file4.xlsxGal2
42file4.xlsxDragon10
43file4.xlsxFlowers4
44file4.xlsxPark1
45file4.xlsxGreg4
46file4.xlsxAndreea2
47file4.xlsxMatei2
Sheet2
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Select the filename column in the Power Query editor.
Select the Transform ribbon tab.
Click the Pivot Column and select the Count column name as the Values column (the column name in your data structure).
Click Ok.

1677333856581.png


The M Code will be something like this:

VBA Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    PivotedColumn = Table.Pivot(Source, List.Distinct(Source[filename]), "filename", "Count", List.Sum)
in
    PivotedColumn

And the result:
namefile1.xlsxfile2.xlsxfile3.xlsxfile4.xlsx
Adrain214
Alexandra72929
Ana25
Andreea42
Babriel88
Black41112
Coleman3727
Dean3
Dennis13
Dragon1210
Flowers44
Gal82
Greg64
Matei2
Michael484
Ned410
Park1
Paul89
Peter6
Robert55
Steven2
Terry61
Theodor517
 
Upvote 1
Solution
(y) nice
Thank you!

Select the filename column in the Power Query editor.
Select the Transform ribbon tab.
Click the Pivot Column and select the Count column name as the Values column (the column name in your data structure).
Click Ok.
 
Upvote 0

Forum statistics

Threads
1,223,964
Messages
6,175,658
Members
452,664
Latest member
alpserbetli

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