Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 |
---|---|
A | 10 |
B15 | 15 |
C10 | 10 |
D15 | 20 |
F50 | 20 |
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 |
---|---|
A | 10 |
B15 | 15 |
F50 | 20 |
OTHERS | 30 |
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.,
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
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]
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
But then I would have two different "others" right? how to only have one???
You will only have one OTHERS, if use either of the two approaches
and i have to do a left join over my existing table right?
You can use it in the same table:
LOAD Product,
If(Match(Product, 'A', 'B15', 'F50'), Product, 'OTHERS') as [New Product]
FROM Source;
The thing is that i am working under a binary file, so maybe a left join over the product would work
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