Jump to content

Set column name conditionally in cross table


Michael Zaragoza

Recommended Posts

I need to set the column name in a cross table conditionally. I've tried the following two ways but Spotfire objects to what follows after the "AS" keyword. My two attempts:

Count(DISTINCT [serialNum]) AS if([TYPE]~="WS", [initialProd],[FinalProd])

Also tried:

CASE

WHEN [TYPE]~="WS" THEN

Count(distinct [serialNum]) AS [initialProd]

ELSE

Count(distinct [serialNum]) AS [FinalProd]

END

Note: the horizontal axis is set to (Column Names).

Is there a way to do this

Link to comment
Share on other sites

I don't think you can do it the way you are trying - potentially, one column would be split in two.

 

Instead, I think you could do it with a series of calculated columns, with the first one a simple if statement to produce text:

 

if([TYPE]~="WS", "InitialProd","FinalProd")

 

Then do your calculation over this calculated column.

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