Spotfire中如何按指定范围对列内任务值进行分组?
Got it, let's tackle this overlapping grouping problem—since your tasks span multiple months (like Task 3 belongs to both September and October), a simple single-value grouping won't cut it. Here's how to set this up properly:
Step 1: Build a Calculated Column for Multi-Month Assignments
First, we'll create a calculated column that lists all applicable months for each task. This lets tasks belong to multiple groups instead of just one.
- Go to
Data > Add Calculated Column - Name the column something like
Task Month Groups - Paste this expression (adjust task number ranges if needed):
Concatenate( If([Task] >= 1 AND [Task] <= 5, "September;", ""), If([Task] >= 3 AND [Task] <= 7, "October;", ""), If([Task] >= 5 AND [Task] <= 9, "November;", "") )
- Critical: Set the column's data type to List (String). To do this:
- Right-click the new column in the Data panel
- Select
Column Properties > Data Type - Choose
List (String)and set the delimiter to;(matches the semicolons in our expression)
This generates a list of months for each task—for example, Task 5 will show September;October;November, Task 3 will show September;October, etc.
Step 2: Use the Group Column for Visualizations or Analysis
Now you can use this column to group your data in two common ways:
Option A: Group with Multi-Value Lists
If you want to see tasks grouped by all their applicable months at once (e.g., a bar chart showing counts of tasks per combined month group), just drag the Task Month Groups column into your visualization's grouping axis.
Option B: Split into Separate Rows for Each Month
If you need each task to appear in every month group it belongs to (e.g., Task 3 shows up in both September and October rows), use the Unpivot tool:
- Go to
Data > Transform Data > Unpivot - Select the
Task Month Groupscolumn - Choose to split by the list delimiter (
;) - Spotfire will create a new row for each month assigned to a task, making it easy to analyze each group independently.
Bonus: Quick Grouping in Visualizations (No Calculated Column)
If you only need the grouping for a single visualization, you can use a custom expression directly in the grouping axis:
Case When [Task] Between 1 And 5 Then "September" When [Task] Between 3 And 7 Then "October" When [Task] Between 5 And 9 Then "November" End
Note: This will only assign the first matching month to each task, so it's better for non-overlapping needs. Stick with the calculated list column for overlapping groups.
内容的提问来源于stack exchange,提问作者BULB

