Portfolio Item Query Examples
The Query field, available in the Custom List and Portfolio Kanban Board apps as well as the Portfolio Kanban page, provides you with a way to filter the data displayed using multiple criteria.
You can enter queries into the field to find specific portfolio items or their associated work items.
Note that field values must be queried using the correct case. For example, if a username in
Rally
is capitalized as [email protected], a query formatted as (Owner.UserName = "[email protected]")
will not work. The value must match exactly in the query.Learn more about formatting syntax in the Query field.

Queries will not return work items that reside in projects you are not scoped to or do not have permission to view. Ensure that you have permissions in the projects you want to query.
Examples of Queries for Portfolio Items
See the following examples for common portfolio item queries.
- Portfolio Items With Specific Text in the Name
- This example is useful if you use various naming conventions to identify different groups of portfolio items:(Name contains "Technical Debt")
- Portfolio Items With a Specific Investment Category
- (InvestmentCategory = "Cost Savings")
- Portfolio Items With a Specific Custom Field Value
- (c_MyCustomField = "MyCustomValue")
- Create a Custom List That Shows All Leaf Stories Attached to a Feature
- ((Feature.FormattedID = F3550) AND (DirectChildrenCount = 0))
- Unscheduled Features
- (Release = null)
- Features in Current Release
- ((Release.ReleaseStartDate <= today) AND (Release.ReleaseDate >= today))
- Leaf User Stories Attached to Features in Current Release
- (((Feature.Release.ReleaseStartDate <= today) AND (Feature.Release.ReleaseDate >= today)) AND (DirectChildrenCount = 0))
- Scheduled for a Release
- (Release.Name = "PSI 2013.Q1")
- Portfolio Items with a Specific Parent
- (Parent.Name = "Design new login page")
- Portfolio Items with No Parent
- (Parent = null)
- Portfolio Items With No Child Portfolio Items or User Stories
- (DirectChildrenCount = "0")
- Portfolio Items in Backlog or Implementing States
- (State.Name IN "Backlog,Implementing")
- Portfolio Items That Have a State Other Than Discovering or Done
- ((State.Name !="Discovering") AND (State.Name !="Done"))Querying in WSAPI for a portfolio item state, such as a state of Done, results in an error. To view results based on portfolio item state, you can use the filter field on the Custom List app.
- Portfolio Items That Have a State Between Discovering and Done
- In this example, the State field on portfolio items uses an ordered value to identify the custom states. Discovering is the first available state, and has a value of 1. Done is the final state, and has a value of 4:((State.OrderIndex > 1) AND (State.OrderIndex < 4))
- Portfolio Items That Have Total Completion Percent (by Story Count) of 50% or Less
- (PercentDoneByStoryCount <= ".50")
- Portfolio Items That Do Not Have Tags That Contain Specific Text
- (Tags.Name !contains "Blue")
- Portfolio Items With Two Tags: Red and Blue
- ((Tags.Name = "Blue") AND (Tags.Name = "Red"))
- Portfolio Items With Three Tags: Red, Blue, and Green
- (((Tags.Name = "Blue") AND (Tags.Name = "Red")) AND (Tags.Name = "Green"))
- Portfolio Items Owned by Mike or Sally
- ((Owner.UserName = "[email protected]") OR (Owner.UserName = "[email protected]"))
- Portfolio Items That Have an Actual Start Date After November 5, 2019
- (ActualStartDate > "2019-11-05")
- Portfolio Items That Have a Planned Start Date Later Than Last Week
- (PlannedStartDate > "lastweek")
- Portfolio Items That Have Planned Dates, But Not All Associated User Stories are Finished
- (((PlannedStartDate != null) AND (PlannedEndDate != null)) AND (PercentDoneByStoryCount <= ".50"))
- All Child Stories Under a Specific Portfolio Item
- Set a custom list app to view user stories, then enter the FormattedID of the parent portfolio item in the query:(PortfolioItem.FormattedID = "F123")
- Query on Stories in a Story Hierarchy That Rollup to a Leaf Portfolio Item Allocated to a Specific Release
- In this example, we display a custom list showing leaf stories not allocated to an iteration that roll up to a leaf level PI (Feature) assigned to release 2014.Q2:(((Feature.Release.Name = "2014.Q2") AND (Iteration.Name = null)) AND (DirectChildrenCount = 0))
- Filter Out Features With No State or Archived Features
- ((Tags.Name = "RPM") AND (State.Name != null) AND (State.Name != "Archived"))
- Portfolio Items In Progress
- This includes portfolio items that have had at least one story accepted.((PercentDoneByStoryCount > 0) AND (PercentDoneByStoryCount < 1))ORThis includes portfolio items that have stories in progress but nothing has been accepted yet.((ActualStartDate != null) AND (ActualEndDate = null))
- Finished Portfolio Items
- ((ActualStartDate != null) AND (ActualEndDate != null))
- Recent Portfolio Items and Portfolio Items In Progress
- (((ActualStartDate != null) AND (ActualEndDate = null)) OR ((ActualStartDate != null) AND (ActualEndDate = LastQuarter)))
Useful Fields for Portfolio Item Queries
Below are some fields that may help you build a specific query. Not all fields are listed. To see if a field is available for use, check your Web Services API documentation.
Syntax | Description |
|---|---|
AcceptedLeafStoryCount | The number of user stories (without children) associated to a portfolio item with a state of Accepted. |
ActualStartDate | The date work actually began on a portfolio item, generated when the first lowest-level story associated to a portfolio item is set with a state of In-Progress. |
Archived | A Boolean field which indicates whether or not a portfolio item is archived. |
Description | Searches contents of the Description field. You can use contains or !contains conditions. |
LastUpdateDate | The last date the portfolio item was edited or created, which can also be updated when associated work items are edited. |
LeafStoryCount | The number of user stories (without children) associated to a portfolio item. |
Parent | The next level up in your portfolio item hierarchy. Use this field to locate a group of portfolio items with a common parent. |
PercentDoneByStoryCount | The percentage of user stories (without children) associated to a portfolio item that have a state of Accepted. |
PercentDoneByStoryPlanEstimate | The percentage of user story (without children) plan estimates associated to a portfolio item that have a state of Accepted. |
PlannedStartDate | The date work is anticipated to begin on the portfolio item. |
State | The Kanban state of a portfolio item. Not to be confused with the Schedule State field of associated user stories. |
Correct Parentheses Syntax in Queries
Parentheses used in queries with multiple conditions must be balanced. For every condition in the query, you must add one
(
to the front of the string. You must also end each condition beyond the first with ))
.Incorrect
((Name = "A") AND (Name = "B") AND (Name = "C"))
Correct
(((Name = "A") AND (Name = "B")) AND (Name = "C"))
Correct Field Name Syntax in Queries
While reviewing the Web Services API documentation, be sure to remember that many fields are objects, which contain child elements. For example, Tags are an object in
Rally
, but have an element to locate the Name.May return inconsistent results
((Tags = "Blue") AND (Tags = "Green"))
Correct syntax
((Tags.Name = "Blue") AND (Tags.Name = "Green"))
Ensure that the correct field name is placed to the left of the operator, and the value or date variable is to the right of the operator. A query such as (AcceptedDate < InProgressDate) is invalid, because it contains field names on both sides of the operator.
Query Fields That Do Not Contain Specified Text
When using the
!contains
(does not contain) condition against a text or string field, you may see fewer results than expected. For example, the query below will find work items that both
have a non-empty Notes field, and do not contain the word "blue":(Notes !contains "blue")
To find work items that contain text other than "blue"
and
work items with empty fields, structure your query like this:((Notes !contains "blue") OR (Notes = null))