Rank within subsets of data in spotfire - subset

I am trying to rank subsets of my data in spotfire.
Lets say I have a data table that has the following 6 columns:
Individual, City, Zip Code, State, Amount1,and Amount2.
There are thousands of Unique Individuals in each Zip Code and many Zip Codes within each State. How would I display only the data from the top 5 Zip Codes within each State (as defined by the SUM()of Amount1)?
To summarize the order of operations; I want to sum up Amount1 for each Zip Code, then Rank the Zip Codes in desc order within each State (just an intermediate step for explanatory purposes) and finally, only display the top 5 Zip Codes within each State.
All I could think of was to create a calculated column that would return the Zip Code if it satisfied my conditions and NULL if it did not. I don't think its the best but here is the code I started with:
case WHEN DenseRank(Sum(Sum([Amount1]) over [ZipCode]) over [State],"desc")<6 then [ZipCode] ELSE NULL END
Any help would be great. Thanks!

Thanks for the clarification in the comments.
DenseRank(Sum([A1]) OVER ([ZipCode]),"desc",[State]) as [Rank]
The above function will give rank your [ZipCode] within its respective [State] based on the SUM() of an amount in column [A1]. DenseRank() will NOT skip a ranking number if there is a tie. The means you could have more than 5 [ZipCode] in your top 5. Use Rank() if you want to avoid this.
Then, you can create a calculated column for your filter panel, or just filter it in the "Limit Data using Custom Expressions" section of your chart.
If([Rank] < 6,"Top 5", "Other") as [Zip Rank in State]

Related

Excel Matching Customer Orders by Item and Quantity

Brief:
I have a large dataset, inside of which are Individual customer orders by item and quantity. What I'm trying to do is get excel to tell me which order numbers contain exact matches (in terms of items and quantities) to each other. Ideally, I'd like to have a tolerance of say 80% accuracy which I can flex to purpose but I'll take anything to get me off the ground.
Existing Solution:
At the moment, I've used concatenation to pair item with quantity, pivoted and then put the order references as column and concat as rows with quantity as data (sorted by quantity desc) and I'm visually scrolling across/down to find matches and then manually stripping in my main data where necessary. I have about 2,500 columns to check so was hoping I could find a more suitable solution with excel doing the legwork on identification.
Index/matching works at cross referencing a match for the concatenation but of course, the order numbers (which are unique) are different so its not giving me matches ACROSS orders.
Fingers crossed!
EDIT:
Data set with outcomes
As you can see, the bottom order reference has no correlation to the orders above it so is not listed as a match to the orders above but 3 are identical and 1 has a slightly different item but MOSTLY matches.

Pivot table with registers duplicate in 2 row

I have a question about how to summarize a list of data, I attached an image of how the data is presented.
The question is how to determine (summarize) the total of activities per unit considering that a person works in 2 units.
You could define that the person working in A / B does 50% of activities for each unit.
As the list of registers is very extensive the idea is to be able to automate, try with a PivotTable and did not give me result.
Any suggestions would be appreciated (xls, sql, etc).
data
http://ge.tt/381feDj2 -> Excel fILE
Am really not the best of people when it comes to Pivot Tables, but assuming i know what you are asking for.
1) Add one extra column (dummy) and just put 1 in it, this will be used to sum the number of events that the criteria occurs.
2) Select the whole table and then Insert=>Pivot Tables
3) Click Ok
4) Set Rows (fecha); Values (dummy); and the rest to Filters.
Then you can choose to filter your output the way you want. If you want A and A/B you can select multiple in the filter options.

PivotTable Average of group columns

I wonder if it's possible to create a table like this:
I have calculated the equity ratio for two companies shown in the column "Calculated field 1". Now I would like to create the average and the minimum value of this column for each company! as shown in the table (red numbers).
For clarification, the column C, row C5 to C26 show the average for company 1.
The row C28 to C49 show the average for company 2.
Any ideas how to proceed this?
Average:=
AVERAGEX(
ALL(Datasrc[Year])
,[Calculated field 1] // Seriously? Come up with a better name.
)
Minimum:=
MINX(
ALL(Datasrc[Year])
,[Calculated field 1]
)
*X() functions take a table expression as their first argument. They step row by row through this table, evaluating the expression in the second argument for each row, and accumulate it. AVERAGEX() accumulates with an average, MINX() with a minimum.
ALL() returns unique elements of a table, column, or set of columns stripped of context. Since we are only calling ALL() on the [Year] column, that is the only column whose context we remove. The context from [Stock Ticker] remains in place.
These two measures are unreasonable in the grand total level.
Ninja edit: There's likely a better way to write the measures, but with no insight into what [Calculated field 1] is doing, I can't make suggestions toward that. *X() functions force single threaded evaluation in the formula engine. It's not a bad thing, but you take a performance hit over queries which can utilize only the storage engine. If you could rewrite it to a CALCULATE(SUM(),ALL(Datasrc[Year])) / ALL(Datasrc[Year]), you'd get faster evaluation for sure, but I have no clue what your data looks like.

Excel dependent list best way to sort 2000 records?

I have a data set of 4 columns and around 2000 rows. I need to produce an easy to use dashboard type product so anyone in can filter down to find the relevant record. Think of it as filtering down eg country - region - city - contact person
I have mocked something up using dependent drop down lists using a much smaller data set but it seems hard to scale this up, is there a better way in Excel of doing this?
PivotTable example, where Data is shown in ColumnsA:E of the same sheet, but could be on a different sheet):
each of id, c, r, c, and p is in ROWS (in order). Each small + and - can be expanded/collapsed independently (in the example all are collapsed except D and elements within D).

Excel Management for Inventory

Okay, hope this question will be clear enough that I can get an answer. Thanks for the help.
The situation is that I am downloading some information into two different spreadsheets which contains orders from two different stores.
The problem is that between these two stores the model numbers (SKU#) for a lot of items are different even though the product is the same. There is no changing that now. I do have a list of equivalencies. For example, I know that 00-XX-55 is the same in Store 1 as 22-FF-33. There isn't a logical equivalency so I would be setting them manually.
My question is if there is any way I can combine data from two sheets and set up manual equivalencies while doing this? Would excel allow me to manage the data in that way I can join the two unequal SKUs
You need a two-column translation table. Once you have this you can manage combined inventory because you can then determine the total inventory of a single item in both stores.
So in a solution do you want to translate all to the store 1 sku, the store 2 sku, or a third warehouse sku? I guess what I am driving at here is that there needs to be a superior synonym to sort of design around.
To build a translation table you would put the original sku (the sku that you will convert from, sort of the inferior number you do not want to go by for purposes of the summarization) into column A and the master sku into column B. We will call this sheet "converter".
You could either have:
A, B
00-XX-55, 22-FF-33
This could normalize everything to the 22- sku. Or you could do this:
A, B
00-XX-55, 123abc
22-FF-33, 123abc
This way if you want to normalize to a third value rather than either of the stores values.
In your inventory page col C is the sku column so in column D put =iferror(vlookup(C, converter!A:B, 2, false), C) and populate that all the way down. Now in each row you have the original and the master sku next to each other in C and D. If the sku was not found in the converter table then it would just use whatever value was in C. You can then build pivots tables using D to group them on.

Resources