Philip Connell
Philip Connell

Reputation: 651

Spotfire, Calculated Columns to show Percentages

I hope you are well and that you can be of assistance. I have a table and I need calculated columns to show what percentage of 'No' 'Yes' and 'Empty' I have. I have attached a picture below. enter image description here

Any help with the syntax would be greatly appreciated.

enter image description here

error screenshot posted by Philip Connell:

enter image description here

Upvotes: 0

Views: 4943

Answers (2)

Philip Connell
Philip Connell

Reputation: 651

The solution is below

Count([CUSTOMER_ID]) as [No. Of Customers], Count([CUSTOMER_ID]) THEN [Value] / Sum([Value]) OVER (All([Axis.Columns])) as [Percentage ]

Thank you all for the support

Upvotes: 0

ksp585
ksp585

Reputation: 1770

@Philip Connell - I have created a calculated column 'consent%' with the below expression and change the format of this column to percentage from column properties.

[number] / [Total amount]

Used this calculated column in a cross table. Screenshots below. Please let me know if this is the solution you are looking for. enter image description here

Refined solution:

I have created some sample data for the sake of explanation.

enter image description here

Added pivot transformation (count of customer ID) while loading sample data into Spotfire.

enter image description here

Created two calculated columns.

Total amount:

Sum([count of Customer_ID]) over ([Country])

consent%:

[count of Customer_ID] / [Total amount]

enter image description here

Upvotes: 2

Related Questions