Calculate age & age buckets from a date field in powerquery - excel

I am trying to create an ageing report from data in Power Query. I'm able to do the following if I pull the data into an Excel table:
Age Column =(TODAY()-[#[Request Date]])
Ageing buckets =LOOKUP(J19372,{-60,2.1,5.1,7.1},{"0-2","2+","5+","7+"})
However every time I refresh the data in the table from the query, I then need to copy the formulas down. This is fine for me but I want it to be automatic for others that I send the file to.
Is there a way to do those calculations in PowerQuery?

Sure you can. Except for retrieving today's date via Power Query, you need to refresh table. Check one solution for banding here at Ken Puls blog: http://www.excelguru.ca/blog/2016/02/29/creating-a-banding-function-in-power-query/

Related

Excel query join tables

I have 4 tables reporting monthly sales of a product line; each table displays sales from a sdepcific channel (B2B, Ecommerce, Monobrand, Customized) and I'd like to stack these 4 tables one after the other.
Each table has the same exact columns, I can't do copy and paste because I need to update the 4 tables monthly.
I've tried to create a unique database and gather the information from the system throug a sequence of IF, IFS and SUMIFS but even though I get to the result, this takes forever in calculation
Is there a way to do it? I don't know, maybe with Powerquery or creating a Power Pivot?
Thank you
Load the tables into Power Query and append them in the Combine section of the Home tab.

Excel XP for inventory management Simple in theory but can't achieve it

I need to create a simple and easy to use inventory management sheet or database.
It may be better to use access as I see it, but people is more familiar using excel.
Imagine a warehouse where we store goods. Goods are often delivered so I have to reduce the stock cound for a particular item. Then if the warehouse is short in some goods, more of these are bought.
The thing is I need to store a history of delivers we make but also store per item the actual count.
I thought having a column for initial items count, then add ins and subtract outs.
I tried using db functions, dynamic tables etc, but the problem is that when I add new registries for new item outs and ins, the dynamic table wont resize it's source and the same for range for functions.
What would be the best way to achieve what I want?
The thing is that we do everything manually, counting, summing and subtracting each time we have ins and outs.
I didn't want to make something overcomplicated to use, but rather save time by automatinc the ins and outs calculations and making it easier to search for particular registries.
You can do this with an Excel Table and a pivot table (or some formulas). The columns should include date, item code, transaction type (coming in or going out), number of units. You can add columns with more information.
Next, enter a starting stock for each item code. Then enter new lines for each transaction. If you have bought new stock, put a positive number into Units. If you have sold or delivered stock, put a negative number.
Then you can build a pivot table that calculates the totals per item code (or use formulas). You can build other pivot tables to calculate values per month or using other data you may want to include in the data entry table.
An Excel Table will automatically adjust formulas and formatting to new rows. If you base the pivot table on the Excel Table, you only need to refresh the pivot table after you have entered new data. If you prefer formulas, you can use Sumifs(), but you need to keep the list of items for the stock totals list up to date manually.

PowerPivot table relationship not working, repeating totals

Longtime answer-seeker, first time question-asker here so I'm open to feedback about how I'm asking as well. I'm relatively new to Excel's PowerPivot but feel like I have a handle on it for the most part.
I am using PowerPivot for Excel 2010. I have data that I only receive weekly totals for and I use the monday of that week as my primary key in the table I call 'WeeklyTracking'. I create a relationship from that to my Date Table so that I can filter/analyze by month, year, etc. I get no error when I make that relationship, it is a one to many ( I checked for duplicates in my WeeklyTracking table), and it is showing as 'active'.
However, when I go to create a pivot table it's not separating the data by my Date Table fields. It simply repeats the total for the column. What my pivot table shows me. Table Relationships
I tired disconnecting all other table relationships, and I even tried converting dates to numeric values and linking those but to no avail. When I choose to make column labels the date within the 'WeeklyTracking' table it separates out by date just fine which leads me to believe it has to do with the relationship. But I did something very similar with data I get monthly and didn't have any problems so I can't figure out what's different.
Any ideas?
EDIT: It's actually not working for my monthly report either, upon closer inspection. But still I dont understand why not--There's a primary key in each table...
UPDATE: Tried creating a ID number using a formula for each week and creating the relationship on that and it didn't work either.

Pivot like query access

I am having a huge database of records and I'm finding it to be a nightmare getting to analyse the data.
Objective:
Group my data by Country of Purchase (rows), by Years/Months (rows), by Product (columns) with the Sum of Paid amount being the value.
Let me explain:
Below is a sample excerpt from my table.
And here is the result that I am looking for that I was able to achieve using an Excel Pivot table:
Why use MS Access:
My table has over 3 million records stored across many workbooks, and Excel has a limit of 1m in each sheet. Also Excel crashes more often than not when loading >500k of data.
I installed an older version of MS Access (2010) which has pivot tables option but it was very slow and did not allow me to group correctly. I then tried using a combination of queries and reports to arrive to my result to no avail.
Any help will be very welcome :)
How about doing the aggregation in Access and then the pivot in Excel?
SELECT country, year, month, product, sum(paid)
FROM myTable
GROUP BY country, year, month, product
(year and month based on access functions for date manipulation... alternatively, you could use is as a date to keep date functionality in the pivot - just make it the first of the relevant month)
Then use this as the source of the pivot table. The pivot table then basically just does the formatting - which it can hopefully do quickly enough

Calculating the difference between the count of two date fields

I have data that is provided to me that includes the routed date and the service restoration date. From that it's pretty easy to generate a pivot table that generates a table with the date of the month, then a count of received tickets (routed), and the count of closed tickets. I'm trying to generate a calculated field (Pivot -> Options -> Fields, Items & Sets -> Calculated Field) to derive the delta.
When I use =Received - Closed, I get the difference in date rather than the delta in the counts. Can anyone point me in a direction on how I may calculate it? If it was static content it would be easy peasy, but I'm not getting the knack of doing this with a pivot table. Also I could achieve something similar with a countif type command and run it from a static calendar type table (which is what I'll probably end up doing if this ends up being a dead end).
As a solution, you can copy the pivot table and paste it as values in the new sheet. Do you math on values instead of on pivot.
I don't know if formatting your results in the pivot as NUMBER would help.. But you can try that as well.
I was unable to determine a way outside of what was mentioned above by Andrew. I've set up a static date list for the calendar month and then use a series of countifs instead of a pivot table to generate the output. Thanks to all who reviewed the question and to Andrew for his responses.

Resources