Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I have the following
Name | Purchase amount | Purchase date |
Bob | 5 | 01/01/2016 |
Bob | 5 | 01/10/2016 |
Bob | 10 | 01/02/2016 |
Ed | 2 | 01/08/2016 |
Sid | 5 | 01/08/2016 |
Is there any way in my load script i can have a cumulative sum on purchase amount so the table ends up looking like this
Name | Purchase amount |
Bob | 20 |
Ed | 2 |
Sid | 5 |
I suggest you use the GROUP BY feature in the load (check it out in the documentation.
It will be along the lines of:
LOAD Name, SUM([Purchase Amount]) as Total_Purchase
FROM ....................
GROUP BY Name;
Of course, in your example, this would give Bob a total of 20.
Do you need something different ?
I suggest you use the GROUP BY feature in the load (check it out in the documentation.
It will be along the lines of:
LOAD Name, SUM([Purchase Amount]) as Total_Purchase
FROM ....................
GROUP BY Name;
Of course, in your example, this would give Bob a total of 20.
Do you need something different ?
LOAD
Name,
Sum([Purchase amount]) as [Purchase amount]
GROUP BY
Name;
LOAD DISTINCT * INLINE [
Name, | Purchase amount | Purchase date |
Bob, | 5, | 01/01/2016 |
Bob, | 5, | 01/10/2016 |
Bob, | 10, | 01/02/2016 |
Ed, | 2, | 01/08/2016 |
Sid, | 5, | 01/08/2016 |
];
Hi Paul,
In your table "Bob" having sum 20 like (10+5+5). how you calculated 15?
Regards