def METHOD_NAME(
	filters,
	sales_users_data,
	sales_user_wise_item_groups,
	actual_data,
	date_field,
	period_list,
	sales_field,
):
	rows = {}
	target_qty_amt_field = "target_qty" if filters.get("target_on") == "Quantity" else "target_amount"
	qty_or_amount_field = "stock_qty" if filters.get("target_on") == "Quantity" else "base_net_amount"
	for d in sales_users_data:
		key = (d.parent, d.item_group)
		dist_data = get_periodwise_distribution_data(
			d.distribution_id, period_list, filters.get("period")
		)
		if key not in rows:
			rows.setdefault(key, {"total_target": 0, "total_achieved": 0, "total_variance": 0})
		details = rows[key]
		for period in period_list:
			p_key = period.key
			if p_key not in details:
				details[p_key] = 0
			target_key = "target_{}".format(p_key)
			variance_key = "variance_{}".format(p_key)
			details[target_key] = (d.get(target_qty_amt_field) * dist_data.get(p_key)) / 100
			details[variance_key] = 0
			details["total_target"] += details[target_key]
			for r in actual_data:
				if (
					r.get(sales_field) == d.parent
					and period.from_date <= r.get(date_field)
					and r.get(date_field) <= period.to_date
					and (not sales_user_wise_item_groups.get(d.parent) or r.item_group == d.item_group)
				):
					details[p_key] += r.get(qty_or_amount_field, 0)
					details[variance_key] = details.get(p_key) - details.get(target_key)
			details["total_achieved"] += details.get(p_key)
			details["total_variance"] = details.get("total_achieved") - details.get("total_target")
	return rows