How to disaggregate historical data in Power Query? - excel

I would much be thankful if someone can help me with this situation.
I have weekly reports of sales by product and store, but these reports are aggregated by year (each report contains sales by year to current date) and I intend to disaggregate the data so I can have the sales of each week of the year in my reports.
Currently I am doing this with an excel formula and I want to pass this to power query / Language M
Here it is the formula in the image
enter image description here
Here is the explanation of the columns
Source.Name.1= The number of the report according to the week
SKU= Product code
Ventas YTD= Sales by year to current date
No.Tienda.number.1= Code of the store
Ventas semana= weekly sales using the excel formula
I currently have a mental block and I would appreciate of you could guide me through the problem

Related

Formula or function for getting salesperson monthly sales average

Salesperson
JANUARY
FEBRUARY
SALES TYPE 1
'=January Ave
'=February Ave
SALES TYPE 2
'=January Ave
'=February Ave
I need help figuring out what formulas/nested functions I would use in the January and February average columns in the above table. The Excel document I'm working with has a tab for each sales person. In these tabs include the above table-like scorecard element.
I'm using the old "Sharing" feature of Excel which has a lot of limitations, you can't have tables in the document for example (experts, correct me if I am wrong about this) this is why I'm hoping to use a formula to get, calculate and input the data where it needs to go.
There is another tab where all the data is stored in a table-like structure. It has columns for the date of the sale, the ID of the sales person and how many sales were made on that day.
I'm also worried that too complicated of a formula being done 24 times in each sheet and there being a total of 50 sheets in the document, would this cause the document to lag? I'm reading on index match vs xlookup, I hear sumifs is easy but the file doesn't work as fast with that?
What formulas would you use? Any advice how to make sure the document runs smoothly when users use it? Any advice here is welcome. Thanks in advance for you patience.

Problem with SSAS ParallelPeriod and Excel 2013 Timeline Filter

Currently i had a project using Microsoft SQL Server Analysis Service. I found a problem regarding filtering data with excel timeline.
Here is my date dimension screenshot:
<img src="https://i.stack.imgur.com/NUr2x.png"/><img src="https://i.stack.imgur.com/5OSgA.png" />
I had a cube with 2 measures, Sales Quantity (measures) and Sales Quantity Last Year (calculation). Here is MDX expression for Sales Quantity Last Year calculation:
( ParallelPeriod([Date].[YM].[Calendar Year],1,[Date].[YM].CurrentMember),[Measures].[Sales Quantity In 1000] )
After deploying the project to my local server, the data can be shown perfectly using excel 2013:
Pic: Data in Excel without filter
The problem start when i want to filter the data using excel timeline. When i filter only '2016', my calculation measure is no longer working. You can see the data in 'Sales Quantity in 1000 LY' column is blank. It looks like that i cant see the data outside current filter (2016). Pic: Filtered using timeline filter
But when i use slicer, the data can be shown normally Pic:Filtered using Slicer
Did i make a mistake in building date dimension? Or i need to fix the MDX calculation query? Because when i test this case in Microsoft AdventureWorksDW2014 with the same date hierarchy and the same calculation, all is going well.
Your parallel period calculation looks correct assuming [Date].[YM] is your date hierarchy. I am guessing that your date dimension is off somehow.
Make sure that:
it has a hierarchy created, and the hierarchy is what you are referencing in the parallel period calculation. Here is an example, you could have more or less attributes in the hierarchy obviously.
Your attribute relationships are defined correctly.
Key columns on the attributes in the hierarchy are correct. In the example above, you would just make year the key for the year column, but then for quarter it would be a collection of the year and quarter column. For period, key columns would be year, quarter, period. For week, key columns would be year, quarter, period, week. Date would just use the date column since date is the key.
4.Make sure that the date key attribute is using a date field for it's value column, as a time slicer needs this.
define time intelligence on your date dimension. Right click on the date dimension on the solution explorer and choose add business intelligence, then on choose enhancement screen pick define dimension intelligence. Then set the attribute type for each dimension attribute. Here is how it would be for our example.
Hopefully one of these does it for you.

Predicting Monthly Brand Sales (Excel 2016)

I'm currently looking at daily sales data of a specific brand over the course of the past year. My objective is to create a formula to roughly estimate the sales growth for future months.
My project isn't going very well, as the brand is very volatile in monthly sales, making it impossible to predict with a basic linear formula. I'm arriving at the conclusion that a single year's worth of sales isn't enough data, and I may have to result to provide a specific formula depending on the month. Is there anything I haven't thought of?
Note: Recording of sales start on the 15th of every month
Your sales are showing seasonality. Consider using sasonal ARIMA models.

Power Pivot DAX formula to compare this year vs previous performance when no date column available

I have a large dataset with 7M records. I have aggregated monthly data for the past 4 years and Lowest level of granularity is at month level with Month number. I need to construct a power pivot table to calculate % difference between this year's performance (YTD) to previous year (YTD last year) on the fly. The SamePeriodLastYear and ParallelPeriod function does not work as the data is not at individual date level. Any help would be greatly appreciated.
create a date column in your monthy data like for april 2017- 1/4/2017 take 1st date of every month
and create a date dimention table that will have continuos date and connect monthly data to date dimention using date column of monthly data
and in SamePeriodLastYear and ParallelPeriod function use date colun of date dimention

Weighted average price of a product per day in Pivot Table

I am having issues translating the following formula to a pivot table; either through a regular pivot table, or through DAX and powerpivot.
=SUMPRODUCT((C$2:C$11)*(D$2:D$11)*(A$2:A$11=A2)*(B$2:B$11=B2))/SUMIFS(D$2:D$11,A$2:A$11,A2,B$2:B$11,B2)
The background is, I have a number of products that appear on an e-commerce site, and I need to find out their price per day. However, these prices change daily, based on things like promo codes, visitor location etc. Therefore, I need their weighted price based on the number of visitors that saw a particular price.
Can anyone help with this translation, or alternatively, offer a better way to approach this problem?
PS- I need it in a pivot table due to the volume of data. At 250,000 rows, standard Excel cannot handle this formula.
The following is in Excel 2010 sans Powerpivot. However, the general approach should work:
Explanation:
I added a column that multiplies the Prices and Visits. The pivot table uses Dates, then Product SKU as the row labels. Then I added a calculated field that divides the Price*Visits by the Visits.

Resources