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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LizardBoi
Regular Visitor

Year on Year and Period by Period using custom calendar

Hi All

 

Im very new to using PowerBi and completly self taught. 
I need some help with creating 2 tables on a report that will show various different things.

 

Our business has 12 periods per year - running from January to January.

I have a date table set up for FinYear, FinPeriod, PriorFinYear, PriorFinPeriod

 

I also have a table with sales data - Invoice Date, Sale Amount, Profit, Margin, Discount Given, Total Passengers etc

 

What I am trying to do is create 2 matrix tables that will give me a breadown of difference between this year and the previous year.  However when I have used the "Parallelperiod' function as soon as I include the final period of the year it then throws the previous year data and is including this year + last year sales.  This is the formula im using - 

Total Sales LY = CALCULATE( [Total Sales TY], PARALLELPERIOD( 'Period Dates'[Booked Date],-1, YEAR))

 

What should I be doing that would  make this work properly?

 

 

4 REPLIES 4
amitchandak
Super User
Super User

I assume it from feb to Jan then you can datesytd ot totalyd, they allow year end

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"1/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"1/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"1/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"1/31"))

 

If it is too custom, then refer :https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blog -Decoding Direct Query - Time Intelligence , Winner Coloring on MAP , >HR Analytics , Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

AlexAlberga727
Resolver II
Resolver II

When I want to calculate Rev from Last year I use the following DAX - 

= CALCULATE ( [TOTAL REVENUE], DATEADD ( dDATETABLE[DATE], -1, YEAR)

 

Essentially - Use DATEADD.

 

Let me know if this works!

@AlexAlberga727  thanks so much - this works - its now not doubling things up for the final period......

 

However, what is now happening is that when I filter the year - to view say 2019 figures - and then change the 2018 - the figures dont agree.

 

Is this because its not excatly year for year dates that our periods run?  So for example the 26th January in 2018 is in P12, but in 2019 its in P1.  How would I get it to display exactly YOY Period by Period?

 

 

Let me get this straight - 

 

When viewing 2018 Total Rev you're seeing a different value than when you're reviewing 2019 LY Rev?

They should be equal when looking at a year's total.

 

 

When I create YoY graphics I typically compare running total utilizing YTD calculations vs LY cumulative Rev.

This type of comparison results in the following - 

 

YoY_Example.png

 

Also - mark my response as the answer and throw me a thumbs up if you could kindly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors