In Wireless Sensor Networks (WSNs), data redundancy is a challenging issue that not only introduces network congestion but also consumes a considerable amount of sensor node resources. Data redundancy occurs due to the spatial and temporal correlation among the data gathered by the neighboring nodes. Data aggregation is a prominent technique that performs in-network filtering of the redundant data and accelerates the knowledge extraction by eliminating the correlated data. However, most of the data aggregation techniques have lower accuracy as they do not cater for erroneous data from faulty nodes and pose an open research challenge. To address this challenge, we have proposed a novel, lightweight, and energy-efficient function-based data aggregation approach for a cluster-based hierarchical WSN. Our proposed approach works at two levels, i.e., at the node level and at the cluster head level. At the node level, the data aggregation is performed using Exponential Moving Average (EMA) and a threshold-based mechanism is adopted to detect any outliers for improving the accuracy of aggregated data. At the cluster head level, we have employed a modified version of Euclidean distance function to provide highly-refined aggregated data to the base station. Our experimental results show that our approach reduces the communication cost, transmission cost, energy consumption at the nodes and cluster heads, and delivers highly-refined and fused data to the base station.