Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to add a new dimension under an existing column?

Hello and thank you for reading,

What I need to do is add a new dimension under an existing column. The project I am working on requires that I sum up some values and then that I present them inside the same table, but under a different dimension:

Product#prod
A10
B1515
C1010
D1520
F5020

The table above would be something like the result table, the "new" dimension has to be add under the column "Product", showing the sum of the C10 and D15 products, as "others", and the drop the listed fields. The end result would look like this:

Product#prod
A10
B1515
F5020
OTHERS30

This tables also have the month on them, so my idea is to make an aggregation summing the two different products and them group them by the month, to proceed to add them inside under product column, but that last part I dont know how to do it.

Thank you.,

1 Solution

Accepted Solutions
sunny_talwar

In that case a left join will work for you.

Left Join(TableName)

LOAD Product,

          If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS') as [New Product]

Resident TableName

View solution in original post

11 Replies
sunny_talwar

In your chart, may be use this as a dimension:

If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS')

or you can do it in the script like this:

If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS') as [New Product]

sunny_talwar

Capture.PNG

cjohnson
Partner - Creator II
Partner - Creator II

Hi Jesus,

What if you use an if statement to create another dimension. Something along the lines of the following:

LOAD

     Product,

     if(MATCH(Product, 'C10', 'D15'), 'Others', Product)     as ProductGrouping

FROM

Source;

Check out my reply in your other post to show how it works for your other example.

Thanks,

Camile

Not applicable
Author

But then I would have two different "others" right? how to only have one???

sunny_talwar

You will only have one OTHERS, if use either of the two approaches

Not applicable
Author

and i have to do a left join over my existing table right?

sunny_talwar

You can use it in the same table:

LOAD Product,

          If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS') as [New Product]

FROM Source;

Not applicable
Author

The thing is that i am working under a binary file, so maybe  a left join over the product would work

sunny_talwar

In that case a left join will work for you.

Left Join(TableName)

LOAD Product,

          If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS') as [New Product]

Resident TableName