cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Half year YTD vs previous period

Hello,

The answer to this problem was solved once before but the result isn't available anymore.

Here is the problem:

 

I need to calculate the Half year YTD of the previous period.

 

I've added a half year column to "DimDate" that computes the first half as 1 and second as 2.

 

My formula for the current half year goes like this:

Half YTD Value = CALCULATE([SalesValue],
FILTER(
        ALL(DimDate),DimDate[Date]<=MAX(DimDate[Date])),
              VALUES(DimDate[Half Year]),
DimDate[DatesWithSales]=true)

Everything works fine!

However, I can't seem to get previous period working. I've tried to use SAMEPERIODLASTYEAR, DATEADD on the ALL(DimDate),DimDate[Date]<=MAX(DimDate[Date])) with no luck. 
 
I know I'm missing something obvious.
 
Thanks!
 
 


 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Half year YTD vs previous period

@Sven_H , if you can have half-year start date, then you have a day of half-year, From that, you can now build it. Refer how to build it WTD. The same way you can build Half-year YTD

 

Similar logic I tested on custom Qtrs

 

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: Half year YTD vs previous period

@Sven_H , if you can have half-year start date, then you have a day of half-year, From that, you can now build it. Refer how to build it WTD. The same way you can build Half-year YTD

 

Similar logic I tested on custom Qtrs

 

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Frequent Visitor

Re: Half year YTD vs previous period

The answer was in front of me and it was ridicolusly simple.

In case anyone is wondering. I've modifed the formula to this:

LY Half YTD Value = CALCULATE([SalesValue],FILTER(all(DimDate),DimDate[year]<=(max(DimDate[Year])-1)),VALUES(DimDate[Half Year]),DimDate[DatesWithSales]=true)

Thanks for your help!

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors