Jump to content

Calculated Column That Returns Column Names of all Columns where Value Greater than X


Nikita Goldovsky

Recommended Posts

Total Time

Stage1

Stage2

Stage3

 

Stage4

 

CalcColumn

 

 

17

2

6

8

1

Stage2,Stage3

 

 

19

8

4

7

0

Stage1,Stage3

 

 

 

 

My data looks like the table above. I want to create a calculated column that will look through the "Stage" columns and return a list ofall column names that exceed a value of 5.

Can anyone suggest the best way to do thisin spotfire

Link to comment
Share on other sites

Given the data above this expression works:

Left($map("If($esc($csearch([Data Table], "Stage*"))>5, '$csearch([Data Table], "Stage*"),', '')", "&"),-1)

CSearch finds all columnnames in Data Table that begins with Stage. The if statement outputs the columname from the identical second csearch and a comma if the escaped column is > 5 and empty string if it is not. Map combines these strings with the concatenate operator & and left finally removes the dangling last comma.

If you have other columns named stage or they're nonnumeric you'll have to modify the search expression somewhat. Also note the hardcoded datatable name [Data Table].

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...