spotfire how to get the last value in a column? - spotfire

I have a data table as below. I would like to get the last [Action] of each [Sstage] of each [ID] based on the [Time].
I tried: last(action)over intersect([id],[stage],[time]) but it is not giving me what I want. does anyone have any idea?
+----+---------+-----------------+------------+-----------------+
| ID | Stage | Action | Time | Last_Action |
+----+---------+-----------------+------------+-----------------+
| 1 | CEO | Decline | 11/01/2016 | requestmoreinfo |
| 1 | CEO | Approve | 11/02/2016 | requestmoreinfo |
| 1 | CEO | Approve | 11/03/2016 | requestmoreinfo |
| 1 | CEO | requestmoreinfo | 11/04/2016 | requestmoreinfo |
| 1 | Manager | requestmoreinfo | 11/05/2016 | Decline |
| 1 | Manager | requestmoreinfo | 11/06/2016 | Decline |
| 1 | Manager | Approve | 11/07/2016 | Decline |
| 1 | Manager | Decline | 11/08/2016 | Decline |
| 2 | User | Decline | 11/09/2016 | Approve |
| 2 | User | Decline | 11/10/2016 | Approve |
| 2 | User | Approve | 11/11/2016 | Approve |
+----+---------+-----------------+------------+-----------------+

This one probably isn't as obvious as most.
We have to find out what the status is for the Max([Time]) over the [ID] and [Stage]. You are close using Last() but that method is to get the logical last row. If your data isn't sorted... then this would give undesired results. Thus, use the Max() method to get the most recent date.
Max([Time]) OVER (Intersect([ID],[Stage]))
Now... this would put the [Time] in your calculated column... since you want the correlated [Action], we need to nest that in an IF() statement to find the [Action]
If([Time]=Max([Time]) OVER (Intersect([ID],[Stage])),[Action])
Now, this would put the correct [Action] in your calculated column, but only on the row containing the Max([Time]).
The last step is to apply this value across your [ID],[Stage] grouping with one more Over() method
First(If([Time]=Max([Time]) OVER (Intersect([ID],[Stage])),[Action])) OVER (Intersect([ID],[Stage]))

Related

I want to count IF both condition are true Logically count by AND excel

I have two Columns both are categorical columns. Like Age_group and Engagement_category. And I want to get count no. of each engagement_category in each Age_group.
This is like GROUP BY function in SQL.
| Engagement_category | Age_group |
|:-------------------:|:---------:|
| Nearly Engaged | 21-26 |
| Not Engaged | 31-36 |
| Disengaged | 36-41 |
| Nearly Engaged | 21-26 |
| Engaged | 21-26 |
| Engaged | 26-31 |
I tried Excel COUNTIFS function but it is showing the count of each unique value in the criteria range that I have provided.
Expected OUTPUT is something like this.
| Age_group | Engaged | Nearly Engaged | Not Engagaged | Disengaged |
|:---------:|:-------:|----------------|---------------|------------|
| 21-26 | 1 | | | |
| 26-31 | | | | |
| 31-36 | | | | |
| 36-41 | | | | |
| 41-46 | | | | |
| 46-51 | | | | |
Thanks!
Use COUNTIFS function, see document: https://support.office.com/en-us/article/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842
Please try:
=COUNTIFS(B:B, "21-26", A:A, "Engaged")
Try inserting a pivot table:
Highlight the source data which is the 2-Column table including headers, go to Insert tab and click the Pivot Table button, set up the Rows, Columns and Values column as below:
The key is to drag the Engagement_Category to both Columns and Values field.

How can I compare two spreadsheets to see if column a is a match AND they overlap ranges =true?

I have two spreadsheets--one represents locations where the road was recently repaired and the second shows all eligible roads based on the road's speed limit. The first spreadsheet has a list of ID's (Column B) and a beginning point (Column E) and ending point (Column F) for the repair location. The second spreadsheet may have multiple matches for each ID (Column A) and the eligible beginning points (Column P) and ending points (Column Q).
I want to compare to see if any portions of the eligible roads are already on the recently repaired list.
Completed repairs = 18SealCoatMap where B=Highway Name, E=Beginning Limit, and F=Ending Limit.
| County | Highway | BDFO | EDFO |
|-----------|-----------|--------|--------|
| Guadalupe | FM0078-KG | 13.064 | 14.018 |
| Guadalupe | FM0078-KG | 14.018 | 14.848 |
| Guadalupe | FM0078-KG | 14.848 | 18.991 |
| Guadalupe | FM0465-KG | 0 | 3.342 |
Elibible repairs =MLOVER45 where A=Highway Name, B=Line ID, P=Beginning Limit, and F=Ending Limit.
| Lane | ID | Highway | SpeedLimit | Begin_DFO | End_DFO |
|-----------|----|---------|------------|-----------|---------|
| FM0078-KG | 1 | FM0078 | 50 | 13.064 | 14.018 |
| FM0078-KG | 2 | FM0078 | 55 | 14.845 | 14.848 |
| FM0078-KG | 3 | FM0078 | 50 | 14.018 | 14.845 |
| FM0078-KG | 4 | FM0078 | 55 | 14.848 | 15.006 |
So far, I'm only working with the beginning point of each eligible location. When I get a working formula, I'll copy it for the ending location.
Here's a more varied example...
Eligible Locations:
| Lane | ID | Highway | SpeedLimit | Begin_DFO | End_DFO |
|-----------|-----|---------|------------|-----------|---------|
| FM0791-KG | 369 | FM0791 | 70 | 0 | 6.909 |
| FM0791-KG | 372 | FM0791 | 70 | 6.909 | 18.603 |
| FM0791-KG | 377 | FM0791 | 55 | 19.286 | 19.486 |
| FM0791-KG | 378 | FM0791 | 70 | 19.486 | 30.971 |
Completed Locations:
| County | Highway | BDFO | EDFO |
|----------|-----------|--------|--------|
| Atascosa | FM0791-KG | 21.619 | 23.196 |
| Atascosa | FM0791-KG | 21.619 | 23.196 |
| McMullen | FM0791-KG | 0.000 | 7.017 |
| McMullen | FM0791-KG | 0.000 | 7.017 |
| McMullen | FM0791-KG | 2.190 | 2.760 |
| McMullen | FM0791-KG | 2.190 | 2.760 |
I tried the following formula but every location came back true:
=IF(A2='18SealCoatMap'!B2:B345,AND(MLOVER45!P2>'18SealCoatMap'!E2:E345,MLOVER45!P2<'18SealCoatMap'!F2:F345),TRUE)
Then I tried:
=INDEX('18SealCoatMap'!B2:B345,MATCH(A2,IF(P2>'18SealCoatMap'!E2:E345,P2<'18SealCoatMap'!F2:F345)),2)
but all of the results came back #N/A
I expect the outcome to be the ID number for the eligible location (or TRUE) if there's a match so that I can schedule repairs for all locations that do not already fall within the limits. Based on the results, I will then schedule locations that are entirely or partially due for repair.

Excel Formula to count all items in a group to see if the status is an Open status

I am working in Excel 2016. I am trying to figure out how many projects I have that have not had any part of it started. For instance if my project id is 203784 and it has 3 parts to it where 2 are Complete and 1 was Not Started. I would not want to count that. If the project had 3 parts and 2 were Not Started 1 was assigned. I would want to count that as 1. Thank you in advance you your assistance.
+----+------------+------------------+-------------+
| | A | B | C |
+----+------------+------------------+-------------+
| 1 | Project ID | Position | Status |
| 2 | 203784 | Staff | Complete |
| 3 | 203784 | Staff | Complete |
| 4 | 203784 | Staff | Not Started |
| 5 | 203785 | Maintenance | Complete |
| 6 | 203785 | Maintenance | In Progress |
| 7 | 203786 | Grounds | Complete |
| 8 | 203787 | Nurse | Complete |
| 9 | 203788 | Teacher | Complete |
| 10 | 203788 | Teacher | Complete |
| 11 | 203788 | Teacher | Complete |
| 12 | 203789 | Transportation | Complete |
| 13 | 203789 | Transportation | Complete |
| 14 | 203789 | Transportation | Complete |
| 15 | 203790 | Evacuation | Complete |
| 16 | 203790 | Evacuation | Complete |
| 17 | 203791 | Implementation | Complete |
| 18 | 203792 | Knowledge Base | Not Started |
| 19 | 203792 | Knowledge Base | Not Started |
| 20 | 203793 | Janitor | Not Started |
| 21 | 203794 | Public Relations | In Progress |
| 22 | 203795 | HR | Complete |
| 23 | 203796 | Admin | Complete |
+----+------------+------------------+-------------+
In this example. I would only want the count to show a total of 2. For project numbers 203792 and 203793.
One way would be to add a column (say Count) populated as:
=COUNTIFS(A:A,A2,C:C,"Complete")+COUNTIFS(A:A,A2,C:C,"In Progress")
and then create a PivotTable with Count as Filters and Project ID for Rows. Select 0 for the filter.

Spotfire how to make calculation along one coloumn

I have a data table as below.I would like to create a new column called "Time Difference" which captures the time difference between [STAGE] start and [STAGE] end. Is there any way to do it without using data transformation?
Thank you!
Assuming each ID is unique, and your data is ordered by Time where Stage = Start is the first row for each ID and Stage = End is the last row for each ID, you can use this:
Concatenate(Min([Time]) OVER ([ID]),"-",Max([Time]) over ([ID]))
RESULTS
+----+---------+---------+------+-----------------+
| ID | Stage | Action | Time | Time Difference |
+----+---------+---------+------+-----------------+
| 1 | Start | approve | A | A-F |
| 1 | Process | approve | B | A-F |
| 1 | Process | approve | C | A-F |
| 1 | Process | approve | D | A-F |
| 1 | Process | decline | E | A-F |
| 1 | End | approve | F | A-F |
| 2 | Start | approve | G | G-I |
| 2 | Process | decline | H | G-I |
| 2 | End | approve | I | G-I |
+----+---------+---------+------+-----------------+
If your data isn't already sorted, you can just apply a Rank() to fix this. Let me know if that's the case.
EDIT WITH NEW DATA
EXPRESSION
Concatenate(Min(If((Upper([Stage])="START") and (Upper([Action])="APPROVE"),Max([Time]) OVER ([ID]))) OVER ([ID]),"-",Min(If((Upper([Stage])="END") and (Upper([Action])="APPROVE"),Max([Time]) OVER ([ID]))) OVER ([ID]))
Simplified
Concatenate(Min(If((Upper([Stage])="START") and (Upper([Action])="APPROVE"),[Time])) OVER ([ID]),"-",Min(If((Upper([Stage])="END") and (Upper([Action])="APPROVE"),[Time])) OVER ([ID]))
RESULTS
+----+---------+---------+------+-----------------+
| ID | Stage | Action | Time | Time Difference |
+----+---------+---------+------+-----------------+
| 1 | On hold | decline | A | C-H |
| 1 | Start | decline | B | C-H |
| 1 | Start | approve | C | C-H |
| 1 | Process | DECLINE | D | C-H |
| 1 | Process | approve | E | C-H |
| 1 | Process | approve | F | C-H |
| 1 | End | decline | G | C-H |
| 1 | End | approve | H | C-H |
| 2 | Start | approve | I | I-K |
| 2 | Process | decline | J | I-K |
| 2 | End | approve | K | I-K |
+----+---------+---------+------+-----------------+

Microsoft Excel - Use a drop down list to extract data from another workbook

If i select an option from a drop down list, how do i then display data extracted from another workbook. So far, i have seen examples of showing single row data from another worksheet. But i have yet to see a method of extracting multiple rows and columns of data from a different workbook.
Week 1.xls:
A B C
-------------------------------------------------
| SKU | Description | Vendor Style |
-------------------------------------------------
| | | |
| 000001 | Description 1 | CA0080-03E |
| 000002 | Description 2 | EX1134-59D |
| 000003 | Description 3 | EM0132-59A |
| 000004 | Description 4 | EW8694-52D |
| 000005 | Description 5 | FC0003-18D |
| 000006 | Description 6 | EK2273-59E |
Master.xls:
A B C
------------------------------------------------- ________ _
| SKU | Description | Vendor Style | |________|>| <---Drop Down List
-------------------------------------------------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
If i choose, e.g. Week 1 in the drop down list. I want the data from Week 1.xls to fill in the table in Master.xls.
If i choose, e.g. Week 2 in the drop down list. I want the data from Week 2.xls to fill in the table in Master.xls.
Is this possible? I'm thinking vlookups may be involved here in order to point to each workbook.
Thank you.

Resources