Jump to content

Create Calculated Column in Custom Expression Based on User Defined Document Property Selection


Karim Kardous

Recommended Posts

Hello,

Custom expression should say:

IF(${SomeRandomDocumentProp} = 'X'

,Avg([elapsed_time])

,IF(${SomeRandomDocumentProp} = 'Y'

, Sum([total_orders])

, Sum(total_spend)

)

)

so i don't know how Spotfire can deal with default selection but the idea is to write a dynamic calculation in the custom expression itself.

Apologies for no code but no code was really working at all.

Thank you,

Link to comment
Share on other sites

Please go to Spotfire help and search for: 'Properties in expressions, general information'

If you do not want the property value to be interpreted as a column name but as a literal string value, you should put the property call within quotation marks.

So you should use:

IF('${SomeRandomDocumentProp}' = 'X'

,Avg([elapsed_time])

,IF('${SomeRandomDocumentProp}' = 'Y'

, Sum([total_orders])

, Sum([total_spend])

)

)PS: You might want to check out CASE functions as well instead of usingmultiple IF statements

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...