Hi, would i'd like to achieve is to know everyday how much of the budget was spent the day before.
$selector = new Selector();
$yesterday = date('Ymd',strtotime("-2days"));
$today = $yesterday = date('Ymd',strtotime("-1days"));
$selector->setFields(["Amount","Cost"]);
$selector->setDateRange(new DateRange($yesterday, $today));
$selector->setPredicates([
new Predicate('AssociatedCampaignId', PredicateOperator::IN, [$idcampagna])]);
$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setReportName('Report per la campagna #' . $idcampagna);
$reportDefinition->setDateRangeType(ReportDefinitionDateRangeType::CUSTOM_DATE);
$reportDefinition->setReportType(ReportDefinitionReportType::BUDGET_PERFORMANCE_REPORT);
$reportDefinition->setDownloadFormat(DownloadFormat::CSV);
$reportDownloader = new ReportDownloader($session);
$reportSettingsOverride = (new ReportSettingsBuilder())
->includeZeroImpressions(false)
->build();
$reportDownloadResult = $reportDownloader->downloadReport($reportDefinition, $reportSettingsOverride);
$result = $reportDownloadResult->getAsString();
$result2 = array_filter(explode("\n",$result));
The problem is that the Cost is greater than the ammount, how that's possibile? any help would be apreciated, thanks