Laurent Cesaro
Laurent Cesaro

Reputation: 341

Spotfire Add several columns with a custom expression

I would like add several columns in a Bar Chart in Y with a custom expression. I have several columns which begin with "HB" or "PASS". Their number change as well as their name every time I refresh the table. But HB or PASS remains in column name.

I tried to use this expression :

Sum($map("[$csearch([pvtable],"PASS*")]",","))/Count([SUBLOT_ID])

or

$map("[$csearch([pvtable],"PASS*")]",","))

If I have only one column with PASS or HB in key word it works, but not if I have several columns with this key words in their name.

It's an example of my datas. They are in percentage.

LOT_ID   SUBLOD_ID WL_PART_CNT PASS_HB1 PASS_HB2   HB5    HB10   HB13   HB25
Q640123    01         3841       86          11   0.25   0.5    0.25    2
Q640123    05         3841       96           3      0     1      0     0
Q640123    10         3841       80          12      0     2      4     2
Q640123    16         3841       40          50      1     1      4     4
Q640123    22         3841       85           5      9    0.5    0.5    0
Q640345    01         3841       86          11   0.25   0.5    0.25    2
Q640345    05         3841       96           3      1     0      0     0
Q640345    10         3841       80          12      0     2      4     2
Q640345    16         3841       40          50      1     1      4     4
Q640345    22         3841       85           5      9    0.5    0.5    0

I want to put LOT_ID in X, and PASS together in Y. I don't want to color my bar chart but I would like a result like this. One bar chart with all columns PASS and an other with all columns HB.

enter image description here

This bar chart represent HB.

Thank you for your help, regards, Laurent

Upvotes: 1

Views: 1510

Answers (1)

S3S
S3S

Reputation: 25142

You shouldn't need the $map function, only the $csearch

Sum($csearch([pvtable],"PASS*")) /Count([SUBLOT_ID])

EDIT

After looking at your test data, you will need to map the values.

$map("sum([$csearch([pvtable],"PASS*")])","+"),$map("sum([$csearch([pvtable],"HB*")])","+")

Then, on your X-AXIS you will need: <[LOT_ID] NEST [Axis.Default.Names]>

Upvotes: 2

Related Questions