Change column names to value

Hi, can you help me how to change this columns into value in one column?
from this Ex1
to this Ex2

Please help.
-Kat

1 Like

Hi @cxlash , there does not seem to be any transformation of data/values. I mean, the values in the columns SR_130, etc are not used. Only the values in the column Diff that are used.

Just manually add that column Cat and filter out the SR_* columns.

If not, just use a Rule Engine and create a new column Cat for the results:

$ProductGroup$ = "All" => "SR_130"
$ProductGroup$ = "Car" => "SR_3160"
$ProductGroup$ = "Motorcycle" => "SR_6190"

Thankyou for the help, but i need more help. if i want to make like this one, is the same way like you said before use a Rule Engine too?
from this Ex3
to this Ex4

The question would be what is the rule by which you would transform your data. If you could describe that I would assume you could use a combination of chunk loop and transpose but it would be necessary to understand what you want to do.

And maybe you can provide sample data that fully demonstrates your case so one might experiment with it.

3 Likes

Hi @cxlash , there does not seem to be any rules to be applied for the results that you are asking for.

Just like @mlauber71 asked, can you let us know what the rules are?

From what I see, it’s just going by row order.

2 Likes

Hi @cxlash ,

I’m tending to agree with both @mlauber71 and @bruno29a, in that it is difficult to see from your example what your rules are in terms of the rows to retain. I’m not sure if this is because you simply aren’t providing a full picture of the “required result” (and that your actual required result would be a much larger table) or if you aren’t providing the necessary rules which show us the which rows should be retained in your desired output.

At first glance, what you are trying to do appears to be a an “unpivot” with some additional column filtering and sorting. You also have rows filtered out but I’m going to assume that this is because you simply haven’t provided full detail of the output required. On that basis, maybe this could point you in the direction you appear to be headed …

I’ve created a sample table based on your original one but with simplified numbers (to save my typing), but which should suffice as an example. My input data is this:
image

After an unpivot and some filtering and sorting, it returns the data pictured below, which is in the kind of form that you appear to want but doesn’t filter out any rows. I’ll leave that to you to determine how rows would then be filtered (e.g. with a rule based row filter node perhaps?)

Unpivot example.knwf (12.1 KB)

Possibly this will give you something to use as a example where you can then describe the additional rules that you require…

5 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.