Philip Connell Posted September 13, 2016 Share Posted September 13, 2016 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. Any help with the syntax would be greatly appreciated. Link to comment Share on other sites More sharing options...
Sean Riley Posted September 14, 2016 Share Posted September 14, 2016 Do you want the results in new columns in that Cross Table you have If yes, perhaps you can share your dxp or sample data set which shows your exact configuration. Or do you want to create calculated columns that calculate those totals If you want calculated columns, you would expressions like these (i made assumptions of the data table structure that the cross table is based on, so you might need to modify): Count(If([Consent Indicator]='NO',[CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) / Count([CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) as [% NO] Count(If([Consent Indicator]='YES',[CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) / Count([CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) as [% YES] Count(If([Consent Indicator]='' or [Consent Indicator] is null,[CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) / Count([CUSTOMER_ID]) OVER ([Country],[Total Amount in Country]) as [% Empty] Link to comment Share on other sites More sharing options...
Philip Connell Posted September 15, 2016 Author Share Posted September 15, 2016 @Sean Riley: Thank you so much for taking the time to write an answer butafter alot fo hard work I got there on my own. The code is below Count([CUSTOMER_ID]) as [Number of Customer], Count([CUSTOMER_ID]) THEN [Value] / Sum([Value]) OVER (All([Axis.Columns])) as [Percentage] Link to comment Share on other sites More sharing options...
Sean Riley Posted September 15, 2016 Share Posted September 15, 2016 Excellent! Yes, so that looks like the solution for the first approach of getting it right in the cross table. Nice job! Link to comment Share on other sites More sharing options...
gurusai sankar Posted May 8, 2019 Share Posted May 8, 2019 Hi Philip , can you please help on below spotfire query. https://community.spotfire.com/questions/how-get-grand-total-value-all-rows-or-else-how-fix-empty-values-all-rows-except-grand Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now