Calculated Column that Doesn't Decrease - calculated-columns

New here, so cut me some slack if I haven't done this correctly, but I have a problem that has me totally stumped, and I can't find anything else to help.
I'm trying to create a calculated column in Spotfire that will represent the equipment count required for a certain set of circumstances, but that will not go back down over time if those circumstances change in the future.
My data set includes multiple sources, over multiple locations, that have flow rates that vary over time. These sources come online at various points in time, and the total flow from all sources at each location determines the count of equipment that is needed. Each source has flow data for each day. My data set is huge, and has hundreds of locations and sources, over years of data. I'm trying to forecast equipment needs into the future, and as source rates vary over time, the need for equipment decreases and increases, but the equipment remains when the rates decrease. I have a calculated column that tells me how much equipment is needed on that given day, by location, but would like a calculated column (vs. a custon expression in a visualization) that goes up as needed, but never goes down, over time. This way, I can accurately forecast total demand of equipment into the future.
I use DenseRank to rank sources by location and date to create column "Rank", then I use "Ceiling" and "Sum Over Intersect" to create column EquipCount, and then "IF" statement to create a column with a trimmed data set, so it isn't counted multiple times in an aggregated visualization. "EquipRate" is the flow each piece of equip can handle and is a locally defined property:
DenseRank([Source],"ties.method=first",[Location],[Date])
Ceiling(Sum([FlowRate]) over (Intersect([Location],[Date]))/${EquipRate})
if([Rank]=1,[EquipCount],null)
Example data set below (continues over multiple sources, locations, and dates):
SourceName|Location|Date |FlowRate
Source 1 |Plant 1 |1/1/2017 |100
Source 1 |Plant 1 |1/2/2017 |200
Source 1 |Plant 1 |1/3/2017 |50
Source 1 |Plant 1 |1/4/2017 |100
Source 2 |Plant 1 |1/8/2017 |100
Source 2 |Plant 1 |1/9/2017 |200
Source 2 |Plant 1 |1/10/2017 |50
Source 2 |Plant 1 |1/11/2017 |100

Related

excel PowerPivot Auto Calculated Measures & Columns

After looking at a few similarish questions I figured I needed something more specific so asking here. I will start by explaining the situation:
The Setup
I have a Store which sells Cakes, Cookies and Wine. I have the weekly sales data of each product sorta like this:
Product ID
Product Name
Quantity
Value
Week Ending
1
Ginderbread
2
£4
13/01/22
2
Chocolate chip
5
£25
13/01/22
3
Red Wine Bottle
1
£10
13/01/22
4
Sponge Cake
3
£9
13/01/22
Currently every week's data is stored within the same table, with me using a Week filter to show only the week i'm interested in.
Using this Data I created PivotTables that shows the sales of each category, with the ability to drill down to show the specific products. Table looks something like this:
Category
Quantity
Value
Cakes
2
£4
Cookies
7
£29
Wine
1
£10
The issue
I now want to stick in a new calculated column that shows the Value as a %. E.g The total value for the previous table was £43, so Cookies is about 67%. If I drill down, it would show the Chocolate Chip record as 80% and Gingerbread as 20%
I imagine doing this would be easier if each individual week's data was on a different table, but I got a lot of weeks and I also want to do tables showing the sales for over a period of time. Plus I don't know of a way to merge the "value" and "quantity" columns, etc instead of having 1 for each week being shown.
any advice would be appreciated
Create an extra column in the source table (prior to filtering) entitled "perc" calculated as the corresponding value for each row divdied by the total value across all rows (se pic. / eqn. for first row below) --
=E2/$E$6
No calculated fields required - just include perc as the mesaure of interest in your pivot table, with value setting as 'sum':
The reason why this worked is because of the common denominator - which allows one to sum ratios on a 1:1 basis.
Devising a calculated field using the standard 'fields, items & sets' functionality for ordinary pivot tables would not be feasible / possible as far as I am aware. You would need to move into the realm of power pivots and data models - which is not too complicated (readily accesible directly from the field list per below) - however, I see this as unnecessary complication for the task at hand.
Side notes:
Using table names in your functions is sometimes more convenient when entering, albeit may appear tricky at first when reviewing - first eqn above becomes:
=[#Value]/Table1[[#Totals],[Value]]

Pivot Table Column with Value and Calculated Field row per group?

The more I have to work with Excel in helping our customers with advanced reporting, the more I'm amazed at it's capabilities. That being said, I can't seem to find exactly what this customer wants Excel to do.
Scenario:
We have a datasource which refreshes a worksheet containing many rows and columns of a data export from the customer's database. That worksheet then drives the other tabs' charts, tables, etc.
They want to add a table (pivot) which will take their milestones, sum the (ontime) column, and then take the (rownumber) sum for that area and then divide it so they can see how many projects were on time. Simplified data tab looks like this:
RowNum Area OnTime Milestone
------ ---- ------ ---------
1 North 1 M2
2 East 1 M4
3 East 1 M2
4 North 0 M1
5 East 0 M4
and here's the table they want it to produce.
We can get it to do both using a Sum(value) and calculated field, however we can't get the Sum(value) field to go directly beneath the calculated percentage field. Any ideas?
If I understand correctly, it will be enough to move the Values drawer to your Rows:
If you need to change the order of the values (which one will be at the top etc.), you can do this moving the drawers within Values Window at bottom-right.

Historic data with missing dates in excel

Everyone,
I have an excell sheet which I have imported from my ERP program. It contains data about deviations in raw materials which were noted at specific dates.
There are 40 different materials and data was gathered throughout the last year.
The raw data looks like this:
Material name | Date | Deviation
Blue dye |2014.05.01| 50
Yellow dye |2014.07.02|-40
Blue dye |2014.07.04| 10
How can I transform this data to a stock-type chart which would should cumulitive deviations throughout the year (i.e. if Blue dye is always positive, how much had added up on each date).
I have figured out how to sum up the deviations with their previous values, I have also transformed the table so that all the materials have their deviations in a seperate row:
Material name1|Date1|Date2|Date3
|50 |-10 |20
Material name2|Date2|Date5|Date6
|5 |10 |-100
The problem is that the deviations don't happen on the same dates. If they were noted on the same day every week, this would be hard at all. In this case each material might not have a deviation for a month or two, while another has fluctuations every couple of days. I would need to somehow interpolate the data in between the dates, so that every day of the year is filled up.
I would appreciate any ideas, at this point I'm just stuck...
I thought the above may have been a little vague...i've done you a quick example at the link below - there are 3 tabs
1 for the raw data
2 to get the differences by date & material
3 to show stock holding each day by material (with no change should there be no change)
Assuming you wanted to graph this info by date/product you should have no problem doing this from the example.
hope this is of more help!
http://www.filedropper.com/materialexample
I would suggest using the original data but creating a table on a new tab, list the entire year in column A from A2 down then list the 40 materials across in B1,C1,D1...etc
Then Starting in first cell (B2) use SUMIF(AND functions to match the date in A2 and the material in B1. if there is a match then +/- the difference...perhaps start one cell lower down and use B1,C1 etc for the starting number to perform calculations...this should give you the holding at any one point.
Hope to have helped :)

Pivot chart for totals of key value

I have a large collection of data which is formatted similar to the representation below:
Machine1 Name1 Product1 Quantity1 Scrap1 delaytype1 delaytype1time delaytype2 delaytype2time
Machine1 Name2 Product2 Quantity2 Scrap2
Machine2 Name3 Product3 Quantity3 Scrap3 delaytype3 delaytype3time
Machine3 Name4 Product4 Quantity4 Scrap4 delaytype1 delaytype1time delaytype2 delaytype2 time
Now, I have all of the data in Excel sheets, and its quite vast (several thousand sheets, dozens thousand rows combined), and I use pivot charts to graph some of the data. I want to make some charts, lets say how many pieces did each machine produce and so on, and important thing to graph nicely are the dealys. Lets say the machine1, on specific date, had three delays. There are 10 delay codes, ( code 1 is machine broken for example), so the entry would be 1 1 (first 1 means the code, second time in hours). Several delays can happen for one machine for a row, or none. So that field has flexibile length. Each code and its time are in separate cells, like in the sample data I wrote above, each text represents a cell.
Is there a way to make the pivot chart graph this but sum up the individual delays of the same type together? For example, if Machine1 had two rows, and on first had the following delays 1 1 (broken machine, 1 hour), 2 2 (no power, 2 hours), and on the second day, 2 2 (no power, 2 hours), 3 1 (no worker, 1 hour), the result would be 1 1, 2 4 (two hours from day 1, two from day 2), 3 1.
Thanks
At the end, I resolved the issue by porting the data to specifically organized tables and generated the PivotCharts from there.

Current price by cumulative progress against discrete values

I have to implement a set of formulas in Excel whose requirements seem to defy any logical or succinct way to do them with just formulas.
Short Description:
determine (and display) a timeline of a product's "effective" internal cost each day based on 1) the price paid for the product as a series of bulk purchases, and 2) the company's per-day consumption of the product using the price paid for each purchase, until the purchased amount is consumed and then moving on to the next purchase.
Simplified Details:
We have a sheet "PurchSums" with the product's bulk purchase history: (this is actually a pivot table)
| A | B | C | D |
1: Product Name Purch Date Rate Amount
...
23: Prod-Q 12/18/2012 $3.15 123.7
24: 1/24/2013 $3.05 748.2
25: 2/27/2013 $2.86 650.0
... ...
So initially, the internal price should be $3.15/pound until the first 123.7 pounds are used us, then it should switch to $3.05 and so on.
We have a sheet "Volumes" with consumption by day: (product consumption starts on March 1st)
| A | B | C | D |
1: Product Name 3/1/2013 3/2/2013 3/3/2013 ...
...
12: Prod-Q 87.2 77.1 101.5 ...
... ...
And I need to fill in formulas for the daily price sheet "Prices", which has the product's effective internal price for each day (filled-in by hand now):
| A | B | C | D |
1: Product Name 3/1/2013 3/2/2013 3/3/2013 ...
...
32: Prod-Q 3.15 3.15 3.05 ...
... ...
Note here that the price for "Prod-Q" changed to 3.05 on March 3rd. This is because its cumulative consumption reached 265.8 pounds (87.2 + 77.1 + 101.5) which exceeded the 12/18 purchase of 123.7 pounds and so switched from its price of 3.15 to the price of the next purchase from 1/24.
More Details:
The first sheet "PurchSums" is actually a pivot table, if that helps. Unfortunately, I don't think that it does, nor that GETPIVOTDATA(..) is going to be useful here (but I would be happy to be wrong). The information in it comes from another sheet "Purchases" which is just a list of all of the purchases:
| A | B | C | D |
1: Product Name Purch Date Rate Amount
...
11: Prod-Q 12/18/2012 $3.15 123.7
...
34: Prod-Q 1/24/2013 $3.05 748.2
...
67: Prod-Q 2/27/2013 $2.86 650.0
...
Additional:
First, I would like to do this as much as possible with Formulas in the existing cells/sheets. Plus I would like to minimize the number of additional sheets that have to be added to support this, as the workbook is already pretty substantial.
Secondly, yes I know that I could do this with VBA functions, and I will do that if there's no better way, but I would like to avoid that if possible because in my experience, populating the formulas of large sheets with massive VBA function calls can lead to some significant performance issues.
I would be grateful for any ideas on how to effectively approach this.
So what you are describing is a FIFO inventory accounting system. First In First Out. You might want to read up on it here:
http://en.wikipedia.org/wiki/FIFO_and_LIFO_accounting
and here:
http://accountingexplained.com/financial/inventories/fifo-method
Basically under FIFO you are making the assumption(whether right or wrong) that the first items that you are adding to your inventory are the first ones you are going to use up in your production. As opposed to LIFO which makes the assumption that the last items that you add to your inventory are the first ones that you are going to use up. That would only require a small change in my solution but let's focus on FIFO since that is your question.
So for every day that you operate you need to figure out how much of your inventory you used up and how much you paid for that inventory. So if you bought 20 items at 50 dollars and then another 20 items at 100 dollars the next day - and on the third day you used up 30 of the items in production, you used up (20 * $50 ) plus ( 10 * $100 ) = $2000 worth of inventory. 2000 / 30 = your effective cost of the product for the day(66.6666667). This effective cost is purely informational for the day - you probably wouldn't want to use it for any accounting - although you could with some rounding corrections - it would just be an indirect way to go about it.
So my solution uses a really ugly table. Basically for every day that you operate you need to figure out how much of your inventory you are using up and how much you paid for that inventory - and then divide it by the total amount used up in the day. Something like this should work for you:
=(IF(AND($E8>G$4,$E8>G$5),G$3,0)+IF(AND($E8>G$4,$E8<G$5),($E8-G$4),0))-SUM(G$7:G7)
=(IF(AND($E9>G$4,$E9>G$5),G$3,0)+IF(AND($E9>G$4,$E9<G$5),($E9-G$4),0))-SUM(G$7:G8)
=G8*$C8
=SUM(G13:G15)/G3
These formulas are all auto-fillable. And you could add on to this table as much space as you need(and probably improve it quite a bit). A small program in almost any language could accomplish this much easier and more intuitively than excel - but this works fine.
In practice, oftentimes nobody really knows which pieces of inventory are being used up and thus how much you paid for them. But the system persists nonetheless - usually the reason many accounting practices are done are the same as why the ancient peoples of the earth sacrificed animals - because that's how it's always been done - tradition and folklore. And for the most part it serves them quite well - routine sources of protein are healthy. I could think of some better ways to do it but - alas. Good Luck.
Assuming you know how to:
display product names on every row from the pivot table
extract lower- and upper-bound interval points from the Amount values from the pivot table
sum Volumes from all previous days from the correct row for each product
cover edge cases like volumes outside defined amount intervals
use Office 2007+ tables
use named ranges
...
For the first day, you want the maximum price = the first row for a given product name:
=INDEX(PurchSums[Rate], MATCH(this_row_product_name, PurchSums[Product Name], 0))
For every other day, you want to sum Volumes from all previous days and extract the rate from matching interval of Amounts for a given product name:
=SUMIFS(PurchSums[Rate],
PurchSums[Product Name], this_row_product_name,
PurchSums[Amount above], TEXT(sum_of_previous_volumes_for_product, "<=General"),
PurchSums[Amount up to], TEXT(sum_of_previous_volumes_for_product, ">General"))
Note that sum_of_previous_volumes_for_product > PurchSums[Amount above] and all the other conditions should be met in 1 row only, so we sum exactly 1 row.
Example:
For cell E16 the named ranges would be replaced / point to:
this_row_product_name = Prices[[#This Row],[Product Name]] = Prices[#Product Name] = $B16
sum_of_previous_volumes_for_product = =SUM(OFFSET(Volumes[[#Headers],[2013-03-01]:[2013-03-02]], MATCH(this_row_product_name, Volumes[Product Name], 0), 0)) = SUM($C12:D12)
So basically you want to summarize your "PurchSums" sheet and "Volumes" ones into one that combines the date fields??
If this is the case....
In your summary sheet make a row filled with the dates
Make a column for Purchase amount
Make a column for Volume amount
Under the Purchase amount use a match / index formula like this:
=index({Select the column C from "PurchSums"},match( {Select date from third sheet},{Select date column from "PurchSums"},0))
Similarly do the same thing for the Volume column.
Hope this gets you on your way if I am not far off on what you are trying to accomplish.

Resources