top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Year over Year (YOY) change percentage Calculations in Postgres and Power BI : A comparison

Year over Year (YOY) change percentage calculation is about the numbers indicating the growth/ decline percentage for every year in relation to its previous year in the same time period. For instance: if a company wants to analyze its Black Friday sales this year with respect to Black Friday sales in previous year, it can be done using YOY calculations.


The mathematical formula for calculating YOY percentage is:



We will use the table below to calculate YOY%



First, let's explore how to calculate YOY percentage in Postgres:



Above is the simple formula to calculate YOY% in Postgres.


After plotting the values with Date, we get the following line chart:



Next, we will see how we can perform these calculations in Power BI.


We will create a new measure with the formula for calculating YOY.



After plotting the values with Date, we get the following line chart:


These two are the simplest methods by which we can calculate YOY% in Postgres and Power BI. An important point to note is that if dataset contains missing or null values, we have to handle those as well by functions such as NULLIF, IFERROR, ISBLANK and COALESCE, else Arithmetical Operations error might occur.


Thanks for reading!

41 views0 comments

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page