Multiple Custom Expression with conditions for single bar chart - spotfire

I have been trying to calculate "Overtime" in a single chart for an analysis. The data table looks like this:
Name _Hours _Shift Type
Tom___5.5 ____ Long
Dick ___6 _____ Long
Harry__7.7 _____Short
Jon ___4.5 _____Short
Tom ___5.6 _____Long
Dick ___5.41 _____Long
Harry ___5.22 _____Short
Jon ___5.03 _____Short
Tom ___4.84 _____Long
Dick ___4.65 _____Long
Harry ___4.46 _____Short
Jon ___4.27 _____Short
Tom ___4.08 _____Long
Dick ___3.89 _____Long
Harry ___3.7 _____Short
Jon ___3.51 _____Short
For Long shifts sum([Hours])> 19 per employee is overtime.
For Short shifts sum([Hours])> 18 per employee is overtime.
I have tried data limiting using:
[Shift] = "Long" and Sum([Hours])>19 for long shift people
and [Shift] = "Short" and Sum([Hours])>18 for short shift people.
and created two different charts and I was successful.
How do I do that in the same bar chart with two different calculations?
Any help would be nice.

Related

Pivot Table -- How to pass Metric as Filter when viewing Raw Data

Let's say I have the following data in Excel:
Book Country Book Store Book Is New?
Hamlet US Amazon 0
Hamlet CA Amazon 0
Hamlet US Barnes & Noble 0
Hamlet CA Barnes & Noble 0
Harry Potter 1 US Amazon 1
Harry Potter 1 CA Amazon 1
Harry Potter 1 US Barnes & Noble 1
Harry Potter 1 CA Barnes & Noble 1
Harry Potter 2 US Amazon 1
Harry Potter 2 CA Amazon 1
Harry Potter 2 US Barnes & Noble 1
Harry Potter 2 CA Barnes & Noble 1
I would like to create a Pivot Table to get the number of "New Books" per Book Store - Country combination. For example, the number of "New Books" on Amazon-US would be two -- Harry Potter 1 and Harry Potter 2. Here is the Pivot Table I have:
However, when I click into any of the metrics to get the raw data. It gives me all books at that cell-intersection. For example, if I click the Amazon-US new releases, which shows 2, it will produce 3 results, basically ignoring how the calculation is done, and passing the filters from the Rows (Amazon) and Columns (US):
Is there a way (even if it's hack-ish) to be able to pass the filter of "Book Is New?" when double-clicking a value. In other words, if it says 2, and I click it, it should show 2 data rows, instead of 3. Attached is the xlsx workbook if helpful: https://www.dropbox.com/s/uqdll138fcsfsse/SO_Example.xlsx?dl=0.
The Show Details feature produces a subset of the source table whose entries match the current filter context for the chosen value. As you currently have it set up, both Book Store (via the Pivot Table Rows field) and Country (via the Pivot Table Columns field) make up part of that filter context. Book Is New?, however, is not applying any filter context.
In order to make it so, you could place that field in either the Filters area of the Pivot Table or else in a Slicer and set it to 1.

Iterative Counter Using Arrayformula in Google Sheets

I have a dataset and want to create a simple counter using an arrayformula that counts the number of occurrences of a person in the table. I want it to give the below result in column "Counter":
Name Counter
John 1
Harry 1
Peter 1
Mark 1
John 2
John 2
Harry 2
Harry 3
This is easily achieved using
=countif($A$2:A2,A2)
But I need it within an arrayformula if possible!
If you are using google sheets, you can try
={"Conter"; Arrayformula(if(A2:A="",,countifs(A2:A, A2:A, row(A2:A), "<="&row(A2:A))))}
and see if that works?

Split Names in Excel using multiple characters

I've had some luck modifying formulas I've found on this site to separate names in a spreadsheet but I need some help. Can anyone suggest the best way to achieve my goal?
I have a "Tenant" column where each row contains from 1 -5 names, separated by commas and "&".
My data is pretty consistent so there is no need for error routines and it looks like these examples with the max # names being 5:
John Doe, Mary Smith, Rachel Reyes & Ben Thompson
or
John Doe & Mary Smith
or
John Doe, Mary Smith & Rachel Reyes
What I really want to do is separate each name into it's own column and then separate each first name into a another column. I would have a total of 5 columns for full names and 5 more for first names for up to 5 max names if that makes sense.
So for this data: John Doe, Mary Smith, Rachel Reyes & Ben Thompson
Column:
|A|B|C|D|E|F|G|H|I|J|
John Doe|John|Mary Smith|Mary|Rachel Reyes|Rachel|Ben Thompson|Ben|
Any help is appreciated.

Unique numbering of unsorted sets

Is there a way to make this
---A---
John
John
Tim
steve
John
-------
into this:
-----A--------B------
John 1
John 1
Tim 2
Steve 3
John 1
---------------------
Have a large data file with duplicate names, and would like to number them in the way mentioned in order to use them in another way.
Please try:
=IF(COUNTIF(A$1:A2,A2)=1,MAX(B$1:B1)+1,VLOOKUP(A2,A$1:B1,2,0))
in B2 copied down, with labels or blanks in Row1.

Excel countif or if

Tried doing this a few ways and I think I'm just looking at this a little too complicated.
I have column a with several different names that repeat. I have column B with dollar amounts. I'm trying to get a formula that will add the totals amount for a specific person.
JOHN $17.23
JAMES $37.52
JOHN $14.23
JAMES $27.52
APRIL $32.00
APRIL $143.20
JOHN $90.27
JOHN $81.13
JOHN = Total for John
JAMES = Total for James
APRIL = Total for April
Thank you
Assuming this table
A B
1 Names Bill
2 John 10
3 Tom 20
4 John 4
5 Tom 3
To get the total for each name you can write
A B
7 Names Total
8 John =Sumif(A2:A5;A8;B2:B5)
9 Tom =Sumif(A2:A5;A9;B2:B5)
This will sum up each value for the given area.
Consider:
=SUMPRODUCT((A$1:A$8="John")*(B$1:B$8))
=SUMPRODUCT((A$1:A$8="James")*(B$1:B$8))
=SUMPRODUCT((A$1:A$8="April")*(B$1:B$8))
Striking my original response in favor of:
=SUMIF(B3:B10,"=JOHN",C3:C10) I tested that, and it works even better

Resources