Ricardo
Ricardo

Reputation: 63

Calculated Value Percent of Subgroup Spotfire

I want to create a calculated value in Text Area that show me % of a column with a certain status over all status. How can i do this? Example:

Count([Protocol]) of Status 'A' / Count([Protocol]) of all status, and show this like a percent.

Sum([Value]) of Status 'A' / Sum([Value]) of all status.

Upvotes: 2

Views: 206

Answers (1)

drxl
drxl

Reputation: 364

You can nest an if statement inside a sum to get the numerator of each expression (counts or sums). They both have a sum for the numerator, but the if statement returns differently. For the count, you return 1 if the status is the one you are looking for and 0 otherwise. This effectively performs a count. For the case where you actually want the sum, the if returns the value of your Value.

Sum(If([Status]="A",1,0)) / Count([Protocol])
Sum(If([Status]="A",[Value],0)) / Sum([Value])

Upvotes: 1

Related Questions