Calculate month to month movement in power query

%3CLINGO-SUB%20id%3D%22lingo-sub-2356824%22%20slang%3D%22en-US%22%3ECalculate%20month%20to%20month%20movement%20in%20power%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356824%22%20slang%3D%22en-US%22%3EHello%2C%20this%20is%20my%20first%20post!%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20working%20with%20a%20data%20file%20that%20provides%20sales%20data%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20is%20presented%20as%20client%20name%2C%20sales%20Y2D%202021%20and%20sales%20for%20the%20same%20period%202020%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20file%20is%20sent%20each%20month%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20monthly%20files%20are%20saved%20to%20a%20sharepoint%3CBR%20%2F%3E%3CBR%20%2F%3EI%20can%20work%20out%20through%20power%20query%20how%20to%20pull%20the%20new%20file%20each%20month%20to%20calculate%20the%20growth%20each%20month%20on%20a%20Y2D%20basis%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20like%20however%20to%20be%20able%20to%20show%20month%20to%20month%20what%20the%20movement%20is%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20would%20be%20through%20adding%20a%20new%20column%20each%20month%20with%20the%20year%20to%20date%20position%20that%20could%20then%20be%20graphed.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20this%20possible%20without%20VBA.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20very%20limited%20excel%20knowledge%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2356824%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2357737%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20month%20to%20month%20movement%20in%20power%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2357737%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1054488%22%20target%3D%22_blank%22%3E%40geoffw100%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELook%20into%20Power%20Pivot%20especially%20in%20the%20area%20of%20Data%20Modeling.%26nbsp%3B%20Therein%20your%20will%20find%20your%20treasure%20trove%20of%20answers.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2358627%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20month%20to%20month%20movement%20in%20power%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2358627%22%20slang%3D%22en-US%22%3EThanks%20for%20the%20direction.%3CBR%20%2F%3E%3CBR%20%2F%3ECould%20you%20expand%20on%20what%20you%20would%20do%20%2F%20I%20need%20to%20look%20for%20in%20power%20pivot%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%3C%2FLINGO-BODY%3E
New Contributor
Hello, this is my first post!

I am working with a data file that provides sales data

It is presented as client name, sales Y2D 2021 and sales for the same period 2020

The file is sent each month

The monthly files are saved to a sharepoint

I can work out through power query how to pull the new file each month to calculate the growth each month on a Y2D basis

I would like however to be able to show month to month what the movement is

This would be through adding a new column each month with the year to date position that could then be graphed.

Is this possible without VBA.

I have very limited excel knowledge
4 Replies

Hi @geoffw100 

 

Look into Power Pivot especially in the area of Data Modeling.  Therein your will find your treasure trove of answers.

Thanks for the direction.

Could you expand on what you would do / I need to look for in power pivot?

Thanks

Hi @geoffw100 

 

Here's a video about Power Query, Power Pivot, and Calendar Tables rolled into one video that covers same period last year type of implementation.

https://youtu.be/e-CFYi52gpc

Download Files: https://people.highline.edu/mgirvin/AllClasses/218_2016/218Excel2016.htmIn this video learn about:1. (00:16) Introduction to Entire Project, ...

@geoffw100 

Question is bit abstract for the concrete suggestion.

I assume you have monthly totals for each client, not all transactions. Since all files are on Sharepoint folder I assume they all data from this files is collected and combine with Power Query in one table in resulting file which looks like

image.png

We would like to add M2M on client basis, not totals for all clients. To generate such transformation for one client

reference above query as new,

filter on one (any one) client,

sort by months,

add two Index columns one starts from 0 and another starts from 1.

merge table with itself on these two indexes

expand sales from resulting table (actually that will be ones for previous month)

add columns with different

remove unused columns

 

Preparing such query for one client transform it into the function with table as parameter. Group initial query by clients and apply above function as aggregation.

Result is like

image.png

My assumptions could be wrong, plus not clear how you would like to use results. Depends on this that could be another transformation and do you need to work with data model or not.