search min value in already summarized group in excel pivot - excel

Example:
Region - Customer - Value
1 - a - 2
1 - a - 3
1 - b - 4
2 - d - 1
2 - d - 5
2 - c - 6
2 - c - 1
I want to show min value in certain region by summarized customer. Somehow excel should first summarize values by customer (a=5, B=4, C=7, d=6) and only than search min value by region.
Correct pivot table at the end would be:
Region - min value
1 - 4
2 - 6

To get the exact pivot table described (with only Region and Min Value columns), you need to add a helper column with the following formula (created after turning your data into a table to use table references):
=SUMIFS([Value],[Region],[#Region],[Customer],[#Customer])
Then add Region as Row Field, helper column as Data Field, then summarise values by Minimum.
Alternatively, you could generate a pivot table with the required values without a helper column, however you'll also need to also display the Customer column and apply a filter to it:
Create Pivot Table
Add Region as Row Field
Add Customer as Row Field
Add Value as Data Field
Change Report Layout to Tabular Form (PivotTable Tools > Design tab)
Remove Subtotals and Grand Totals (also on Design tab)
Right click on Customer Field in PivotTable
Select Filter > Top 10...
Set to: Show Bottom 1 Items by Sum of Value

Related

Excel - Lookup date in matrix and return column heading

I have a matrix between Products and Enablers, where the intersection between the two represents a point in time.
Product list
Enabler 1
Enabler 2
Enabler 3
Product 1
10-Oct
11-Oct
20-Oct
Product 2
20-Nov
25-Nov
01-Dec
Product 3
10-Oct
21-Oct
25-Oct
I need to turn this into a 'timeline' view so visually there are two ways to see the data, where the dates are across the top and based on the timing in the first table, it returns the corresponding 'Enabler' at the correct date...something like
Product list
10-Oct
11-Oct
12-Oct
Product 1
Enabler 1
Enabler 2
Product 2
Product 3
Enabler 1
Does anyone have any ideas how I'd do this? I think it requires an INDEX MATCH array formula as it needs to look across the matrix to find the date in that row, then return what is in the header column...but this isn't my area of expertise and I just can't seem to figure out how to make it work.
One approach might be to return this as an array. You could do:
=IF( ( Table1[[Enabler 1]:[Enabler 3]] = B7:D7 ) * ( Table1[Product list] = A8:A10),
Table1[[#Headers],[Enabler 1]:[Enabler 3]],
"" )
where Table1 is an Excel Table that holds your Product List and Enablers as columns (as shown in your first table); A8:A10 is the list of products in your second table; and B7:D7 is the list of dates in your second table shown as column headers. The formula would be placed in the upper left cell of your second table - in my example, B8 as shown here:
The result will spill into the second table.
If you wanted your second table to be an Excel Table, the approach
would be different as arrays cannot spill into Excel Tables.

Excel Pivot Table: Different Subtotals for Different Value Fields

I have an excel pivot table with two summed field values. I need to subtotal the first one using sum and the second one using average. Here is the desired output:
Region
State
SumOfSales
SumOfUnitsSold
A
NY
100
5
A
NJ
200
3
A Subtotal
300
4
B
FL
250
4
B
GA
300
2
B Subtotal
550
3
So far the closest thing I've been able to find is a custom subtotal through the field settings for Region. But this adds two rows for subtotals. Any ideas?

find longest string in with criteria - excel

I have two columns Item and ID - refer to the Sample Table. I need a formula in Excel to determine the longest (based on simple length of ID) per item.
Here is what I am trying to extract from the sample table:
Item 1 ABCDABC
Item 2 XXXYZ
I tried index match combination:
=INDEX("ID column",MATCH(MAX(LEN("ID column")),LEN("ID column"),0),MATCH("Item 1" , "Item Column",0))
with ctrl+shift+enter
here are the results:
Item 1 ABCDABC
Item 2 #REF!
Any help will be greatly appreciated.
Sample Table
Item ID
Item 1 ABC
Item 1 ABCD
Item 1 ABCDA
Item 1 ABCDAB
Item 1 ABCDABC
Item 2 X
Item 2 XX
Item 2 XXX
Item 2 XXXY
Item 2 XXXYZ
This will return the correct index:
=INDEX($B$2:$B$11,MATCH(MAX(INDEX(LEN($B$2:$B$11)*($A$2:$A$11=D3),)),INDEX(LEN($B$2:$B$11)*($A$2:$A$11=D3),),0))
A PivotTable is perfect for this, because it will handle ties.
Turn your source data into an Excel Table
Add a new column to your source data, and use the LEN function to
return the length of each item. You only need to add the formula to the top row, and Excel will copy it down using Table notation:
Make a PivotTable out of that Table, and put Item and ID in the ROWS
pane and put Length into the Values pane:
Right-click on one of the cells in the Sum of Length PivotField, and
change the aggregation to MAX:
Click the ID filter dropdown, and select Values Filter > Top 10...
In the dialog box, change the 10 in the to a 1 and click OK:
BING!
...and if two IDs within the same category have the exact same length, the PivotTable shows you both of them:

Multiple Calculated Columns with Filters within Single Pivot Table

I am working to create a Pivot Table in Excel that has multiple calculated fields that take into account whether a condition is true, but cannot figure out how to create this within a single Pivot Table.
Behind the scenes, I have a set of data with a column that can have these values: A,B,C,D,F,L, or R.
I have another column that is a dollar value, and another for Quantity.
I am trying to calculate the price per unit when the Category is A,B, or C, but also calculate the price per unit when the Category is D.
I can create multiple Pivot Tables and tie them to the same slicer, but the issue is this: I need to display the spending in each of the two categories for each location, and when I create two separate Pivot Tables for this, locations that do not have spending in one of the categories are excluded (in this below case, location 2 has no spending in Category D, so it does not show up in the second Pivot Table).
Here is a portion of my data set. The whole data set is over 100,000 rows and will change over time, so I do need a solution for the long-term.
Location Category Volume Quantity
1 A $120.32 6000
3 A $30.08 1300
3 A $60.16 2600
1 B $39.91 1000
2 B $318.50 13000
2 C $196.00 8000
1 D $220.50 8100
3 D $171.50 6300
3 D $35.90 1000
3 D $53.85 1500
2 F $416.50 0
1 L $24.50 0
2 L $30.08 0
1 R $55.13 0
2 R $55.13 0
3 R $110.26 0
Thanks in advance for your help and let me know if I need to clarify anything!
Alright, a little more digging yielded the answer.
A slicer should be included that has all locations selected, then it should be tied to all Pivot Tables in use.
For all Pivot Tables, go to Field Settings, then click on the Layout and Print Tab. Check the box 'Show items with no data'.
Then go to Pivot Table Options and select the values you would like to display for blanks and errors.
I found the solution here.

SSAS - Data Warehouse structure and the Unknown value

I have a table that shows summed monthly values grouped by different analysis codes
TableId Month Value Analysis1ID Analysis2ID
1 1 100 1 NULL
2 1 50 NULL 3
3 1 50 2 NULL
4 1 50 3 NULL
I have set the above as a fact table (also have a dimension for the analysis values).
As you can see the table has a new row for each unique ID for the analysis column.
We are then analysing the data in excel, Simply summing the Value column and grouping by Analyis1ID, Month
This give us :
AnalysisID1 1 = 100
AnalysisID1 2 = 50
AnalysisID1 3 = 50
Unknown = 50
Total = 250
This all looks ok apart from the Unknown, which is summed total of NULL....
I have tried excluding the NULL Value in the Dimension by setting the UnknownMember to "Hidden".
This does work but it does not exclude the amount from the total. How can i exclude it from the total value?
I am guessing that the table structure is not correct for that data, I'm unsure though how else to structure it?
Any help or guidance would be appreciated
I would not have NULL values in dimension members, in the past i've always used an Unallocated Member with a -1 ID.
You could then use Cube Security to filter out the Unknown or Unallocated members.
I would Filter that row out using Excel. Right-click on the cell labelled 'Unknown' and you can choose Filter / Hide Selected Items.

Resources