Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Year Over Year percentage for Monthly Data

Hello, 

I am trying to calculate YoY % Change for 3 data points: Revenue, Spend, ROAS (Measure) and display in a table.

 

The current chart is below. I would like to add Revenue YoY % Change, Spend YoY % Change, ROAS YoY % Change. 

Attempted using the solution here - https://community.powerbi.com/t5/Desktop/Year-over-Year-calculation/m-p/75403/highlight/true#M31393. However, I believe that failed because this data set is not continuous but by month? 

 

Any help is appreciated!

Thanks!

 

Data Source: 

datasource.JPG

 

Current Chart: 

Currentchart.JPG

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@Anonymous,

Firstly, create a date table following the instructions in this blog: https://kohera.be/blog/business-intelligence/how-to-create-a-date-table-in-power-bi-in-2-simple-steps/.

Secondly, create relationship using StartMonth field and Date field between two tables.

Thirdly, create the following measures in  your current table.

SumRevenue = SUM(Table2[Revenue])
LastYearRevenue = CALCULATE([SumRevenue],DATEADD('Date'[Date],-1,YEAR))
YOYRevenue = ([SumRevenue]-[LastYearRevenue])/[LastYearRevenue]
SumSpend = SUM(Table2[Spend])
LastYearSpend = CALCULATE([SumSpend],DATEADD('Date'[Date],-1,YEAR))
YOYSpend = ([SumSpend]-[LastYearSpend])/[LastYearSpend]

In addition, we need to know the DAX formula you use to create ROAS.

Regards,

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msft

 

Hello, 

 

Thanks for the response.

I created the Date Table per instructions in the link you provided. Used this formula: 

Date =
ADDCOLUMNS (
CALENDAR(DATE(2000,1,1), DATE(2025,12,31)),
"DateAsInteger", FORMAT([Date], "YYYYMMDD"),
"Year", YEAR ([Date]),
"Monthnumber", FORMAT([Date], "MM"),
"YearMonthnumber", FORMAT([DATE], "YYYY/MM"),
"YearMonthShort", FORMAT([DATE], "YYYY/mmm"),
"MonthNameShort", FORMAT([DATE], "mmm"),
"MonthNameLong", FORMAT ([Date], "mmmm"),
"DayOfWeekNumber", WEEKDAY ([Date],2),
"DayOfWeek", FORMAT ([Date], "dddd"),
"DayOfWeekShort", FORMAT ([Date], "ddd"),
"Quarter", "Q" & FORMAT ([Date], "Q"),
"YearQuarter", FORMAT ([Date], "YYYY") & "/Q" & FORMAT ([Date], "Q"),
"StartOfMonth", FORMAT ([Date], "YYYY/MM/1")
)

 

However, in the YoY Table I need to create a relationship for, the date is First Of Month. Example: 6/1/17, 6/1/17, 5/1/16, etc. 

When I tried to create a relationship between the two tables (YoY and Date) it did not work since it is Many to Many. 

Do you know how I would change the Date table code above to only have the Start of Month? This way the relationship could be Many to One. 

Thanks in advance for your help!

 

@Anonymous,

Would you mind sharing me the PBIX file? In your scenario, as long as you don't have duplicated values in Date field of Date table, you are able to create relationship using First Of Month field and Date field.

Regards,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.