Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table as shown below
fruitID fruitvalue
1 3
1 4
2 5
2 7
3 9
3 4
1 8
1 9
Now i need to create a table in script(Load editor) such a way that,it has give sum of fruitvalue for each fruitID
fruitID fruitvalue
1 24
2 12
3 13
I do know that, using table by dimension:fruitID && Expression: fruitvalue i can achieve this,but i need to get from scripting itself like it has to loop for specific fruitIDs and get sum of those.
IS it possible?if not, Could please share reason for this
if yes, How could i do this? Any ideas, suggestion is helpful
Hi!
You could do something like
fruits:
load
fruitID,
sum(value)
inline
[fruitID,value
1,3
1,4
2,5
2,7
3,9
3,4
1,8
1,9
]
group by fruitID
;
if it is a load inline.
Clearly you can decline it also to a sql select or other things.
you can also do something like
fruits:
load*inline
[fruitID,value
1,3
1,4
2,5
2,7
3,9
3,4
1,8
1,9
]
;
STORE fruits INTO [lib://yourdirectory/fruit.qvd] (qvd);
fruits2:
load
fruitID,
sum(value)
from [lib://yourdirectory/fruit.qvd] (qvd)
group by fruitID;
Drop Table fruits;
to do not have a table that could be useless.
Hi,
Try like this
Data:
LOAD
*
FROM DataSource;
LEFT JOIN(Data)
LOAD
FruitID,
Sum(value) AS TotalFruitvalue
RESIDENT Data
GROUP BY FruitID;
Regards,
Jagan.