I have issue with having percentage of the count of each API compared to total count of APIs.
i’ve had challenges through Mixpanel JQL to reach this purpose, i used reducer also.
now i’ve got that each item, always carries the data of that specific ‘api_endpoint’, so does this mean that i can never have percentage of each API in a column in front of ‘Counts’ column?
function main() {
return Events({
from_date: '2024-08-01',
to_date: '2024-08-15'
})
.filter(function(event) {
return event.name === "api_response" && event.properties.api_response_type === "success";
})
.groupBy(['properties.api_endpoint'], mixpanel.reducer.count())
.map(function(item) {
var apiName = item.key[0];
return {
"API Name": apiName,
"Counts": item.value
};
});
}
My expectation is to have this :
API Name | Counts | Percentage |
---|---|---|
api_name_01 | 8 | 20.51% |
api_name_02 | 13 | 33.33% |
api_name_03 | 3 | 7.69% |
api_name_04 | 9 | 23.07% |
api_name_05 | 6 | 15.38% |