Joining Two Data-sets in PowerPivot by Month - join

I've got 2 different data sets, revenue and contracts sold, that I need to join based off of year and month in PowerPivot so when I use my slicers, they'll filter accordingly. I know part of this will involve coming up with some temp tables for year and month but I can't get those to work. In the contracts sold table, there is an actual date column which I'm then using to format the year/month in "MM-MMM" format:
However, the revenue comes in only as a YYYYMM format:
So the solution would have to take into account this aspect as well. It's been a while since I've dealt with PowerPivot and I recall the PowerPivotPro or Kasep de Jonge's site containing something about linking tables based off of common month but I can't find those pages anymore. If anyone could point me in the right direction or give me some insight, it'd be greatly appreciated.
I'm using Excel 2010 with PowerPivot version 11.0.3000.0.
Thanks,
Joshua

Joshua, I think the solution can be quite simple:
In the contracts sold table, create a new calculated column (a new column within a powerpivot window) that would give you the same date format as is in the revenue table (YYYYMM).
Use Create Time Dimension app in Excel 2013 -- this app creates a date-table with unique dates which makes everything much easier. As with the other table, create a new calculated column with the same format (YYYYMM).
Make a relationship between those tables -- the date table will be linked to revenue as well as contracts.
Created required measures (like sums of revenue, number of contracts etc.).
Place a new pivot table - rows will probably be date-based (YYYYMM), with measures coming from both tables it should be easy to create a report that you need.

Related

How Calculate change rate over time with tabular dataset in google data studio?

I seek your valuable support in finding a way to calculate change rate over time with tabular dataset in google data studio. Here is the link to the dataset: https://docs.google.com/spreadsheets/d/1To1n5JJA6uVkLMgwjKhghJgCJpFmtXkqNog4DzfoEbE/edit?usp=sharing
There are many rows with data stamp and have different categories and sub categories. I have created a change rate table manually based on which I want to create charts in google data studio. The charts will be from the raw tabular data not the separate change rate table that is built only for example purpose.
So the chart could be based on a main category (as in the sample) and can also be viewed as sub-category and show change rate over time between the dates.
The dates can sometimes be months or years. I am not very savy with advanced formulas or scripting but I am hopeful someone here would be able to help me out on this. I will be ever so grateful for this :)
I can only provide you with the quotient of datasets between two days. If you need different mappings between dates (day, months, years), for each the following steps have to be done:
generate a new field "yesterday" with: DATETIME_SUB(date, INTERVAL 1 day)
blend this dataset with itself, using as dimension "date" and "yesterday".
Further dimensions are your categories fields A and B.
As metric, you can use the count of the date field.

Conditional Query and Retrieval

I'm making a Google Sheet for our handyman business and need to collect totals on multiple client labor and material activities. I have a pretty decent sheet going, but, since we work for different clients on different days, with lots of other information in between, it would be nice if I could make a cell collect totals from any cell that has their name at the top of the column instead of chasing all over the sheet to get the client's grand total at the end of the week. Kind of like, if any cell in Row 3 has the word (name) Doe in it, return the value in row 10 of the corresponding column (where the labor for that day has been added up for that client on that day). It'd be great if it could add everything up for that client for the week every time their name is mentioned.
Too much to ask? Thanks for any help!!
If you can standardize the column that the name will occur in you can use vlookup to do exactly what you want. You may need to use partial matches as well if you want only check for part of the name https://exceljet.net/formula/partial-match-with-vlookup.

"Relationship may be needed" although relationship is set

I have two simple table in Excel 2010 - Products and Sales:
I then linked them into PowerPivot - and here created the relationship from Sales.ProductId to Products.Id - like this:
Now I'm trying to build a Pivot that for each productId in the Sales table also shows me the Category and the PurchasePrice from the ProductTable. However, here I'm stuck - because the relationship is somehow faulty. When configuring the Pivot, I get a message Relationship may be needed even if the relationship already exists. The resulting - wrong - pivot table looks like this:
though I'm actually trying to achieve this:
I know that I could create calculated columns in the Sales table of PowerPivot and pull all required data using the RELATED DAX function - but as the real world project requires a lot of joins and fields I'm hoping that there's a better solution than this workaround...
I uploaded the example file here.
Peter,
Your question was a bit more tricky than I first though and I spent quite some time digging around, but I think I found the solution after reading this article about making distinct count in related tables.
I have updated your source file (so that Sales table contains more than 1 sales per product) and uploaded it to my public Dropbox folder.
You can see that I created 4 new calculated measures to illustrate my solution and to make it a bit easier to understand (Excel 2010 terminology, in 2013 it's Calculated Field):
Sales Price Total
=SUM(Sales[SalesPrice])
Products Sold
=COUNT(Sales[ProductId])
Purchase Price per Item
=CALCULATE(SUM(Products[PurchasePrice]),Sales)
Purchase Price Total
=[Purchase Price per Item] * [Product Sold]
The key difference here is the formula for calculating purchase price per item. The reason why you should SUM the product purchase price within CALCULATE function is explained in great detail in the linked article (even though in a bit different context):
In this way, any filter active on Sales (the related table) propagates
to the lookup table.
There might be some other parts I missed, but I have tried this in couple other examples and it simply works as it should:

Creating a new Google Spreadsheet based on results in two sources

Using the "importHTML" function, I've scraped two tables from the web, containing results from weekly 5k races. These two tables now exist as two sheets within a Google Spreadsheets document, each of which are titled "19/11/11" and "12/11/11".
These sheets contain several columns, the most important of which are NAME and GRADE (a percentage value that "scores" your time based on your age.
For example:
Max LANCASTER
81.83%
Craig MITCHELL
76.58%
Andy MCGHEE
73.16%
I'd like to be able to create a new sheet with data that looks at this week's results (19/11/11) and compares it to last weeks (12/11/11). If the runner did not compete the previous week, then they are ignored, but if they did, their NAME and GRADE (for both weeks) is shown. This would allow me to sort on GRADE, and find who was the most improved runner.
Can any Google Spreadsheet experts help me figure this one out?
Thanks
Ronnie
There's most likely better ways of doing this than what I'll suggest, but since no experts answered you... here I go!
I'll suppose NAME is on column A and GRADE on B.
In a new "compare" sheet, with the following header:
NAME - GRADE A - GRADE B - DIFF
I'd add these formulas on row 2.
A2: =Filter('19/11/11'!A2:B;Match('19/11/11'!A2:A;'12/11/11'!A:A;0))
C2: =ArrayFormula(Transpose(Split(Concatenate(If(A2:A=Transpose('12/11/11'!A2:A);Transpose('12/11/11'!B2:B);"")&If(Transpose(Row('12/11/11'!A2:A))=Rows('12/11/11'!A2:A)+1;Char(9);""));Char(9))))
D2: =ArrayFormula(FILTER(B2:B-C2:C;A2:A<>""))
And if I'd like the sorted result (as you mentioned), I'd do this:
F1: =Sort(A:D;4;false)

Data warehouse reporting questions

I've just begun diving into data warehousing and I have one question that I just can't seem to figure out.
I have a business which has ten stores, each with a certain employees. In my data warehouse I have a dimension representing the store. The employee dimension is a SCD, with a column for start/end, and the store at which the employee is working.
My fact table is based on suggestions the employees give (anonymously) to the store managers. This table contains the suggestion type (cleanliness, salary issue, etc), the date it was submitted (foreign keyed to a Time dimension table), and the store at which it was submitted.
What I want to do is create a report showing the ratio of the number of suggestions to the number of employees in a given year. Because the number of employees changes periodically I just can't do a simple query for the total number of employees.
Unfortunately I've searched the web quite a bit trying to find a solution but the majority of the examples are retail based sales, which is different from what I'm trying to do.
Any help would be appreciated. I do have the AdventureWorksDW installed on my machine so I can use that as a point of reference if anyone offers a suggestion using that.
Thanks in advance!
The slowly changing dimension should have a natural key that identifies the source of the row (otherwise how would it know what to compare to detect changes). This should be constant amongst all iterations of the dimension. You can get a count of employees by computing a distinct count of the natural key.
Edit: If your transaction table (suggestion) has a date on it, a distinct count of employees grouped by a computed function of the suggestion date (e.g. datepart (yy, s.SuggestionDate)) and the business unit should do it. You don't need to worry about the date on the employee dimension as the applicable row should join directly to the transaction table.
Add another fact table for number of Employees in each store for each month -- you could use max number for the month. Then average months for the year, use this as "number of employees in a year".
Load your new fact table at the end of each month. The new table would look like:
fact table: EmployeeCount
KeyEmployeeCount int -- surrogate key
KeyDate int -- FK to date dimension, point to last day of a month
KeyStore int -- FK to store dimension
NumberOfEmployes int -- (max) number of employees for the month in a given store
If you need a finer resolution, use "per week" or even "per day". The main idea is to average the NumberOfEmployes measure for a given store over the year.

Resources