Dear Community, could you please help me with aggregation in my scenario.
I am stuck with this input JSON, which in report, contains Array of campaigns statistics, which are then expanded in Arrray stats, where there are statistics per month.
I need to aggregate all data by month no matter the campaing to have an output table of the format:
date - from report.stats.date
impressions - sum aggregation of report.stats.impressions per all campagins
conversions - sum aggregation of report.stats.conversions per all campagins
etc.
from some reason i am not able to deal with the double array, through map functions or sums
Thank you so much for any help.
[ { "statusMessage":"OK", "status":200, "report":[ { "endDate":null, "stats":[ { "date":202402, "conversions":0, "conversionValue":0, "totalMoney":10897, "clicks":26, "impressions":335 }, { "date":202403, "conversions":2, "conversionValue":184, "totalMoney":32886, "clicks":64, "impressions":876 }, { "date":202404, "conversions":2, "conversionValue":698, "totalMoney":22091, "clicks":46, "impressions":512 }, { "date":202405, "conversions":0, "conversionValue":0, "totalMoney":22439, "clicks":39, "impressions":359 }, { "date":202406, "conversions":1, "conversionValue":165, "totalMoney":18104, "clicks":37, "impressions":445 }, { "date":202407, "conversions":2, "conversionValue":418, "totalMoney":25875, "clicks":60, "impressions":635 }, { "date":202408, "conversions":5, "conversionValue":1012, "totalMoney":24797, "clicks":60, "impressions":635 }, { "date":202409, "conversions":6, "conversionValue":1999, "totalMoney":30724, "clicks":74, "impressions":650 }, { "date":202410, "conversions":0, "conversionValue":0, "totalMoney":27019, "clicks":72, "impressions":871 }, { "date":202411, "conversions":2, "conversionValue":343, "totalMoney":88326, "clicks":226, "impressions":2342 }, { "date":202412, "conversions":1, "conversionValue":400, "totalMoney":50007, "clicks":137, "impressions":1584 }, { "date":202501, "conversions":3, "conversionValue":489, "totalMoney":25291, "clicks":96, "impressions":1125 }, { "date":202502, "conversions":2, "conversionValue":971, "totalMoney":28698, "clicks":112, "impressions":1558 }, { "date":202503, "conversions":3, "conversionValue":1538, "totalMoney":19533, "clicks":58, "impressions":534 } ], "id":4941061, "startDate":"20230630T00:00:00+0200" }, { "endDate":null, "stats":[ { "date":202402, "conversions":8, "conversionValue":2546, "totalMoney":184348, "clicks":690, "impressions":6924 }, { "date":202403, "conversions":27, "conversionValue":9120, "totalMoney":426155, "clicks":1482, "impressions":18262 }, { "date":202404, "conversions":18, "conversionValue":5411, "totalMoney":548498, "clicks":1182, "impressions":14557 }, { "date":202405, "conversions":27, "conversionValue":10008, "totalMoney":418106, "clicks":1122, "impressions":12982 }, { "date":202406, "conversions":21, "conversionValue":6922, "totalMoney":494788, "clicks":1276, "impressions":14464 }, { "date":202407, "conversions":15, "conversionValue":2881, "totalMoney":303874, "clicks":727, "impressions":8049 } ], "id":4941062, "startDate":"20230713T00:00:00+0200" } ] } ]