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
Anonymous
Not applicable

Calculate Same period last year sales using Custom Calender

hello All,

 

I am trying to calculate same period last year by using Custom calender.

My calender looks like below table.

Year   period         StartDate                    EndDate

2019P0130-12-2018 00:00:0026-01-2019 00:00:00
2019P0227-01-2019 00:00:0023-02-2019 00:00:00
2019P0324-02-2019 00:00:0023-03-2019 00:00:00
2019P0424-03-2019 00:00:0020-04-2019 00:00:00
2019P0521-04-2019 00:00:0018-05-2019 00:00:00
2019P0619-05-2019 00:00:0015-06-2019 00:00:00
2019P0716-06-2019 00:00:0013-07-2019 00:00:00
2019P0814-07-2019 00:00:0010-08-2019 00:00:00
2019P0911-08-2019 00:00:0007-09-2019 00:00:00
2019P1008-09-2019 00:00:0005-10-2019 00:00:00
2019P1106-10-2019 00:00:0002-11-2019 00:00:00
2019P1203-11-2019 00:00:0030-11-2019 00:00:00
2019P1301-12-2019 00:00:0028-12-2019 00:00:00
2020P0129-12-2019 00:00:0025-01-2020 00:00:00
2020P0226-01-2020 00:00:0022-02-2020 00:00:00
2020P0323-02-2020 00:00:0021-03-2020 00:00:00
2020P0422-03-2020 00:00:0018-04-2020 00:00:00
2020P0519-04-2020 00:00:0016-05-2020 00:00:00
2020P0617-05-2020 00:00:0013-06-2020 00:00:00
2020P0714-06-2020 00:00:0011-07-2020 00:00:00
2020P0812-07-2020 00:00:0008-08-2020 00:00:00
2020P0909-08-2020 00:00:0005-09-2020 00:00:00
2020P1006-09-2020 00:00:0003-10-2020 00:00:00
2020P1104-10-2020 00:00:0031-10-2020 00:00:00
2020P1201-11-2020 00:00:0028-11-2020 00:00:00
2020P1329-11-2020 00:00:0026-12-2020 00:00:00

 

As per the above table, every PERIOD is of 4 weeks, and one FY may have 13 periods.

I have sales data as below image.

1.PNG

for 2020, currently i have 4 periods of sales data only, but when i do the sameperiodlast year, then it will take whole sales sum of 2019 which is not fare.

so i want to compare what ever the periods sales values we have in current FY, those no of periods should be compared in every previous year.

 

Can anyone please. suggest me.

Thanks,

Mohan V.

 

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

For a calculated column.

Column = CALCULATE(SUM(Sales[CY_S]),FILTER(ALLEXCEPT(Sales,Sales[F_P]),Sales[F_Y]=EARLIER(Sales[F_Y])-1))

3.PNG

For a measure.

Measure = CALCULATE(SUM(Sales[CY_S]),FILTER(ALLEXCEPT(Sales,Sales[F_P]),Sales[F_Y]=SELECTEDVALUE(Sales[F_Y])-1))

 2.PNG

 

Best Regards,

Jay

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

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

For a calculated column.

Column = CALCULATE(SUM(Sales[CY_S]),FILTER(ALLEXCEPT(Sales,Sales[F_P]),Sales[F_Y]=EARLIER(Sales[F_Y])-1))

3.PNG

For a measure.

Measure = CALCULATE(SUM(Sales[CY_S]),FILTER(ALLEXCEPT(Sales,Sales[F_P]),Sales[F_Y]=SELECTEDVALUE(Sales[F_Y])-1))

 2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , refer to my blog how can you use rank to work with such a period. In your case last year is 13 periods behind

Check this first how to use RANK

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

https://www.youtube.com/watch?v=7Jc3D4iaTqs

 

Then refer this how to work that in case of period

https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739

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.