How to add cumulative values of a set of unique combinations within a Table?
Greetings,
I’d like to know if it is possible to add up the cumulative sum from the values in a particular column that comply with the rule of being part of unique combinations of two ore more columns.
Please find below a simple sample code that could serve as illustration.
T = table({‘John’;’Mary’;’John’;’Mary’;’John’;’John’;’Mary’;’John’},…
{‘Lot A’;’Lot A’;’Lot A’;’Lot Z’;’Lot Z’;’Lot A’;’Lot Z’; ‘Lot Z’},…
datetime({’01/07/2015′;’03/08/2015′;’05/25/2014′;’03/26/2016′;’07/08/2009′;…
’03/01/2020′;’08/23/2010′;’06/15/2008′}),[12; 25; 36; 89; 11; 56; 87; 93],…
‘VariableNames’, {‘Salesperson’,’Lot’,’Date’,’Quantity’});
I’d like to know if I can produce a table that would return the cumulative sum of four possible unique combinations that are derived from the "Salesperson" and the "Lot" columns:
John – Lot A, John – Lot Z, Mary – Lot A, Mary – Lot Z
I’d like a table that would merge and add the cumulative sum of what John sold from Lot A, what John sold from Lot Z, what Mary sold from Lot A and what Mary sold from lot Z, which are the only four possible unique combinations derived from Columns 1 & 2 ("Salesperson & Lot").
As for the date, I’d like this solution to be able to include the date column. I know that the date is not part of the inputs required to derive this cumulative sum, but I’d like each unique combinations to include either the earliest or latest date.
Thank you in advance for your help.Greetings,
I’d like to know if it is possible to add up the cumulative sum from the values in a particular column that comply with the rule of being part of unique combinations of two ore more columns.
Please find below a simple sample code that could serve as illustration.
T = table({‘John’;’Mary’;’John’;’Mary’;’John’;’John’;’Mary’;’John’},…
{‘Lot A’;’Lot A’;’Lot A’;’Lot Z’;’Lot Z’;’Lot A’;’Lot Z’; ‘Lot Z’},…
datetime({’01/07/2015′;’03/08/2015′;’05/25/2014′;’03/26/2016′;’07/08/2009′;…
’03/01/2020′;’08/23/2010′;’06/15/2008′}),[12; 25; 36; 89; 11; 56; 87; 93],…
‘VariableNames’, {‘Salesperson’,’Lot’,’Date’,’Quantity’});
I’d like to know if I can produce a table that would return the cumulative sum of four possible unique combinations that are derived from the "Salesperson" and the "Lot" columns:
John – Lot A, John – Lot Z, Mary – Lot A, Mary – Lot Z
I’d like a table that would merge and add the cumulative sum of what John sold from Lot A, what John sold from Lot Z, what Mary sold from Lot A and what Mary sold from lot Z, which are the only four possible unique combinations derived from Columns 1 & 2 ("Salesperson & Lot").
As for the date, I’d like this solution to be able to include the date column. I know that the date is not part of the inputs required to derive this cumulative sum, but I’d like each unique combinations to include either the earliest or latest date.
Thank you in advance for your help. Greetings,
I’d like to know if it is possible to add up the cumulative sum from the values in a particular column that comply with the rule of being part of unique combinations of two ore more columns.
Please find below a simple sample code that could serve as illustration.
T = table({‘John’;’Mary’;’John’;’Mary’;’John’;’John’;’Mary’;’John’},…
{‘Lot A’;’Lot A’;’Lot A’;’Lot Z’;’Lot Z’;’Lot A’;’Lot Z’; ‘Lot Z’},…
datetime({’01/07/2015′;’03/08/2015′;’05/25/2014′;’03/26/2016′;’07/08/2009′;…
’03/01/2020′;’08/23/2010′;’06/15/2008′}),[12; 25; 36; 89; 11; 56; 87; 93],…
‘VariableNames’, {‘Salesperson’,’Lot’,’Date’,’Quantity’});
I’d like to know if I can produce a table that would return the cumulative sum of four possible unique combinations that are derived from the "Salesperson" and the "Lot" columns:
John – Lot A, John – Lot Z, Mary – Lot A, Mary – Lot Z
I’d like a table that would merge and add the cumulative sum of what John sold from Lot A, what John sold from Lot Z, what Mary sold from Lot A and what Mary sold from lot Z, which are the only four possible unique combinations derived from Columns 1 & 2 ("Salesperson & Lot").
As for the date, I’d like this solution to be able to include the date column. I know that the date is not part of the inputs required to derive this cumulative sum, but I’d like each unique combinations to include either the earliest or latest date.
Thank you in advance for your help. unique, accumarray, table MATLAB Answers — New Questions