Vipin K Posted July 15, 2023 Share Posted July 15, 2023 I have a line chart with 2 lines. the formula for this looks like this: Sum([ontime]) / Sum([total]) as [ontime%], Sum([failure]) / Sum([total]) as [fail%]they are appearing in Y axis as two different lines.Now, I am trying to create a property control which would show either both lines or one of the lines at a time using drop down. but when i use below expression, I am getting error saying expression is not correct after 'as' because I am using two calculations?. Is there another way to fix this. case when ${all} = 'all' then Sum([ontime]) / Sum([total]) as [ontime%], Sum([failure]) / Sum([total]) as [fail%]when ${ontime} = 'ontime' then Sum([ontime]) / Sum([total]) as [ontime%]when ${failure} = 'fail' then Sum([failure]) / Sum([total]) as [fail%]end Link to comment Share on other sites More sharing options...
Gaia Paolini Posted July 17, 2023 Share Posted July 17, 2023 In one case you expect two lines, in other cases only one, but Spotfire needs to always draw two lines. I could not find a perfect solution, but maybe if you hide the legend (I had to colour by column names) and the Y-axis selector, it works better. You can make the colours self-explanatory like green for ontime and red for fail.I also collapsed the three document properties 'all', 'ontime' and 'failure' into one called 'all', with possible values 'all','ontime' and 'fail':case when '${all}' != 'fail' then Sum([ontime]) / Sum([total]) end as [ontime],case when '${all}' != 'ontime' then Sum([failure]) / Sum([total]) endas [fail] Link to comment Share on other sites More sharing options...
Vipin K Posted July 17, 2023 Author Share Posted July 17, 2023 This helped. Thank you so much! 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