Hi @Rayon_11 ,
Kindly find the below code it may helps you.
let params = {
t: InputData /* INFOTABLE */,
columns: "Type" /* STRING */,
aggregates: "COUNT" /* STRING */,
groupByColumns: "Type" /* STRING */,
};
let AggregateData = Resources["InfoTableFunctions"].Aggregate(params);
var totalInfoLength = InputData.rows.length;
for (var a = 0; a < AggregateData.rows.length; a++) {
var countType = AggregateData.rows[a].COUNT_Type;
var typeName = AggregateData.rows[a].Type;
var calculatedPercentage = ((countType / totalInfoLength) * 100).toFixed(0);
for (var i = 0; i < InputData.rows.length; i++) {
if (InputData.rows[i].Type === typeName) {
InputData.rows[i].Percentage_Type = calculatedPercentage;
InputData.rows[i].Category = typeName;
break;
}
}
}
result = InputData;
Input :

Output :

If any other queries please let me know.
Thanks & Regards,
Arun C