Sales Report Power Query

dbethig

New Member
Joined
Dec 16, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I am trying to make a sales dashboard/report. I am pulling data from workbooks within a specific folder. I have combined them into one table in Power Query but I am stuck on how to best display month & year comparisons for the data.

I can do it on a table with an Index Match formula but it's not part of the data set or a pivot table. If I add a column to the pivot table showing the difference to the prev month/year it only works when they are not filtered out.

The dashboard/report needs to only show the selected month (via a slicer currently) as we have a lot of artists to list.

Example data:

ArtistYearMonthSales
John Smith2019Sep
£34,656.41​
John Smith2019Oct
£1,329.16​
John Smith2019Nov
£36,623.60​
John Smith2020Sep
£25,300.52​
John Smith2020Oct
£51,799.10​
John Smith2020Nov
£4,070.83​
Anne2020Sep
£11,710.85​
Anne2020Oct
£9,409.09​
Anne2020Nov
£6,333.35​
Jane Doe2019Sep
£43,231.26​
Jane Doe2019Oct
£58,377.55​
Jane Doe2019Nov
£175,488.00​
Jane Doe2020Sep
£72,141.98​
Jane Doe2020Oct
£113,679.99​
Jane Doe2020Nov
£182,891.55​
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If this works for you, then

Book9
FGHIJK
1ArtistYearMonthSalesTable2.YearTable2.Sales
2John Smith2019Sep£34,656.412020£25,300.52
3John Smith2019Oct£1,329.162020£51,799.10
4John Smith2019Nov£36,623.602020£4,070.83
5Jane Doe2019Sep£43,231.262020£72,141.98
6Jane Doe2019Oct£58,377.552020£113,679.99
7Jane Doe2019Nov£175,488.002020£182,891.55
Sheet1


First bring in your table to PQ, filter for date 2019 only. Save to connection
Duplicate the table and filter for 2010 only. Save to connection

Then merge the tables and join as follows:

Power Query:
let
    Source = Table.NestedJoin(Table1, {"Artist", "Month"}, Table2, {"Artist", "Month"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Year", "Sales"}, {"Table2.Year", "Table2.Sales"})
in
    #"Expanded Table2"
 
Upvote 0
another way
ArtistYearMonthSalesArtistMonth20192020
John Smith2019Sep34656.41AnneNov6333.35
John Smith2019Oct1329.16AnneOct9409.09
John Smith2019Nov36623.6AnneSep11710.85
John Smith2020Sep25300.52Jane DoeNov175488182891.55
John Smith2020Oct51799.1Jane DoeOct58377.55113679.99
John Smith2020Nov4070.83Jane DoeSep43231.2672141.98
Anne2020Sep11710.85John SmithNov36623.64070.83
Anne2020Oct9409.09John SmithOct1329.1651799.1
Anne2020Nov6333.35John SmithSep34656.4125300.52
Jane Doe2019Sep43231.26
Jane Doe2019Oct58377.55
Jane Doe2019Nov175488
Jane Doe2020Sep72141.98
Jane Doe2020Oct113679.99
Jane Doe2020Nov182891.55

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table13"]}[Content],
    Pivot = Table.Pivot(Table.TransformColumnTypes(Source, {{"Year", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(Source, {{"Year", type text}}, "en-GB")[Year]), "Year", "Sales", List.Sum)
in
    Pivot
qtslicer.png
 
Last edited:
Upvote 0
or
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table13"]}[Content],
    Pivot = Table.Pivot(Table.TransformColumnTypes(Source, {{"Year", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(Source, {{"Year", type text}}, "en-GB")[Year]), "Year", "Sales", List.Sum)
in
    Pivot
with Only Create Connection
then Insert - Pivot Table - Use an External Data Source

with the result
pts.png
 
Upvote 0
OOPs! I missed Ann. Like Sandy's solution better than mine.
 
Upvote 0
Sandy,

Getting old is a *****. Having a real Senior Moment, I guess.
 
Upvote 0
The result I have been tasked with is only one row per artist.
1608197539606.png

I have made it work with the top 10 Sales so I can make a table next to it with Index/match as the number of rows doesn't change.

There are over 100 Artists so having rows for every month isn't easy to go through.

If this isn't possible I'll have to go for making it a set 200 rows with the index/match table next to the pivot.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

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