So I have an Excel sheet with a column that contains names and a second column that is a count, how often this name occurs (already done) so my table looks something like this:
Name Name CNT
dog 24
cat 10
rabbit 3
mouse 1
...
My problem is that there are many more values and a lot of them are equal to one, which messes up my pie chart.
Is there a way in Spotfire to combine the ones that are equal to 1 to a new category and the ones between 2 and 10 to another category and so on.
I tried using a custom expression but I can't get it to work.
Thanks for your help in advance.
I was able to create the below table:
Following these steps:
Create "Binned CNT" binned column with the following formula: BinBySpecificLimits([CNT],1,10,50)
Create a calculated column with the following formula: case [Binned CNT]
when "x ≤ 1" then "Less Than 1"
when "1 < x ≤ 10" then "Less Than 10"
when "10 < x ≤ 50" then "Less Than 50"
end
Use those columns to build the below pie chart:
Related
I have two column [Clients] and [Sales], I'd like to create a new column containing a scoring (from 1 to 5) for each "Client" in terms of Sales.
I want to make a ranking of [Sales] and split it, uniformly in 5 groups, then set a label 1 for the highest [Sales], 2 for the second group, etc...
Does someone have an idea of an expression to use ?
You can use the percentile function in conjunction with a case statement. In the screenshot below, I created 5 calculations to find the 20th, 40th, 60th, and 80th percentiles and then created a case statement to rank based on those values.
Percentile calculation:
Percentile([Sales],20)
Case statement:
case
when [Sales]<[20th Percentile] then 1
when ([Sales]>=[20th Percentile]) and ([Sales]<[40th Percentile]) then 2
when ([Sales]>=[40th Percentile]) and ([Sales]<[60th Percentile]) then 3
when ([Sales]>=[60th Percentile]) and ([Sales]<[80th Percentile]) then 4
when [Sales]>=[80th Percentile] then 5
else NULL
end
See attached screenshot
Data sample and calcs
I have 2 years of data on a bar chart and an x-axis that I created by concatenating Year and Month Number into a separate column called "Year - Month"
Number.ToText([Year]) & Number.ToText([Month Number])
The result is
20171
20172
20173
20174
...
201711
201712
20181
20182
20183
20184
20185
...
How can I create a calculated column in M to add a number column that counts 1 - 24 which will allow me to sort the x axis on the chart?
Also how can I make this dynamic allowing any new data in the report to auto increment to 25, 26, 27... into year 3?
Try in Power Query editor:
Go to > Add Column > Index Column > From 1
Not exactly what you're asking for, but you might prefer to create a date column that you could use for your axis instead.
= #date([Year],[Month Number],1)
I am doing month to date recon. and my date is keep on changing which selected by the end user. I filter my dataset using the filter expression base on the date selected.
I used cross table and I have 2 column and compute the difference as expression column.
I also another column expression to validate the result if greater than or equal to 1000 I put Yes or No if not (# column K1Over).
My dilemma is how to use the K1over colum as filter because I only want to display my data that 1000+ as difference or display < 1000
I try a pivot transformation and insert column but there is no sum expression when matching the columns.
Can you please help, or suggest how to implement scenario like this?
Here is sample scenario
Letter Reported PNL PAA Actual DIFF(Calc) K1Over (calc)
AAA 6000 5000 1000 YES
BBB 8000 7500 500 NO - Hide filter out
CCC 2000 1000 1000 YES
DDDD 1000 1000 0 NO- Hide filter out
Much appreciated.
Leo
When you go into the Cross Table properties, the last category is called "Show/Hide Items".
Here, you should add a Rule, selecting your K1Over column, Rule type "Greater than or equal to", Value "1000", When this rule is matched; "Show items"
I'd like to accomplish the following task. There are three columns of data. Column A represents price, where the sum needs to be kept under $100,000. Column B represents a value. Column C represents a name tied to columns A & B.
Out of >100 rows of data, I need to find the highest 8 values in column B while keeping the sum of the prices in column A under $100,000. And then return the 8 names from column C.
Can this be accomplished?
EDIT:
I attempted the Solver solution w/ no luck. 200 rows looks to be the max w/ Solver, and that is what I'm using now. Here are the steps I've taken:
Create a column called rank RANK(B2,$B$2:$B$200) (used column D -- what is the purpose of this?)
Create a column called flag just put in zeroes (used column E)
Create 3 total cells total_price (=SUM(A2:A200)), total_value (=SUM(B2:B200)) and total_flag (=(E2:E200))
Use solver to minimize total_value (shouldn't this be maximize??)
Add constraints -Total_price<=100000 -Total_flag=8 -Flag cells are binary
Using Simplex LP, it simply changes the flags for the first 8 values. However, the total price for the first 8 values is >$100,000 ($140k). I've tried changing some options in the Solver Parameters as well as using different solving methods to no avail. I'd like to post an image of the parameter settings, but don't have enough "reputation".
EDIT #2:
The first 5 rows looks like this, price goes down to ~$6k at the bottom of the table.
Price Value Name Rank Flag
$22,538 42.81905675 Blow, Joe 1 0
$22,427 37.36240932 Doe, Jane 2 0
$17,158 34.12127693 Hall, Cliff 3 0
$16,625 33.97654031 Povich, John 4 0
$15,631 33.58212402 Cow, Holy 5 0
I'll give you the solver solution as a starting point. It involves the creation of some extra columns and total cells. Note solver is limited in the amount of cells it can handle but will work with 100 anyway.
Create a column called rank RANK(B2,$B$2:$B$100)
Create a column called flag just put in zeroes
Create 3 total cells total_price, total_value and total_flag
Use solver to minimize total_value
Add constraints
-Total_price<=100000
-Total_flag=8
-Flag cells are binary
This will flag the rows you want and you can grab the names however you want.
I have a table which describes "Products Per User" distribution.
It has 2 columns nProducts and nUsers:
First row has values nProducts = 1, nUsers = 60000, meaning 60000 users bought 1 product.
Second row has values nProducts = 2, nUsers = 20000, meaning 20000 users bought 2 products, and so on...
I want to calculate its STDEV. How do I do it in excel?
In addition, could you tell me how to calculate in excel how many users bought:
nProducts > thresh?
Thanks
Li
Do you mean you want to calculate the standard deviation of the number of products bought? Try this "array formula"
=STDEV(IF(B2:B10>=TRANSPOSE(ROW(INDIRECT("1:"&MAX(B2:B10)))),A2:A10))
confirmed with CTRL+SHIFT+ENTER
So in a small example if you have 1 product bought by 4 people and 2 products bought by 3 people that will give you the standard deviation of the following values
1,1,1,1,2,2,2
Is that what you need?
Note that you can also use this "non array" version
=(SUMPRODUCT((A2:A10-SUMPRODUCT(A2:A10,B2:B10)/SUM(B2:B10))^2,B2:B10)/(SUM(B2:B10)-1))^(1/2)
which calculates standard deviation by calculating the square root of the average of the squared differences of the values from their average value
Just select all the second column values.
Then on the Ribbon bar:
go to Forumulas
click More Functions
select Statistical
click on STDEV.P
At this point as parameters you should have your second column already selected, just clik OK and you will have your Standard Deviation calculated.
In case you can write it manually the formula is =STDEV.P(B2:B10)
I supposed you have values from the 2nd to the 10th row in column B.
Thanks,
Mucio