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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (5,787)