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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
rohanjasp
New Member

Prior Year Same Month - When dates do not fall into same period

Hi All,

 

anyone have ideas on how to solve the below.

 

Have a Dates table where each date has a fiscal month and fiscal year. as per the screenshot below, date is joined to Fact_ table which has sales transactions.

 

Need to calculate sales for  same fiscal period but prior year sales number, however dates for Fiscal period 1 2025 has dates from 7/1/2024 to 8/3/2024 and Fiscal Period 1 2024 has dates 7/1/2023 to 8/5/2023, anyone know how i can calculate prior year f1 2024 sales, cannot use time intelligence dax functions as the dates falling into FY 1 2025 and FY 1 2024 are not the same .

 

Thanks

 

 

 

rohanjasp_0-1727642776655.png

 

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

Hi @rohanjasp ,

 

According to your screenshot, I think there is a date table with [Fiscal Year] and [FY Startno] to determine the year and month of the fiscal.

I think you can use them in your calculation. You can try code as below to create a measure.

Previous Year =
CALCULATE (
    SUM ( 'TableName'[ColumnName] ),
    FILTER (
        ALLSELECTED ( 'DateTable' ),
        'DateTable'[Fiscal Year]
            = MAX ( 'DateTable'[Fiscal Year] ) - 1
            && 'DateTable'[FY Startno]
                = EOMONTH ( MAX ( 'DateTable'[FY Startno] ), -13 ) + 1
    )
)

Result is as below.

vrzhoumsft_0-1727755887549.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @rohanjasp ,

 

According to your screenshot, I think there is a date table with [Fiscal Year] and [FY Startno] to determine the year and month of the fiscal.

I think you can use them in your calculation. You can try code as below to create a measure.

Previous Year =
CALCULATE (
    SUM ( 'TableName'[ColumnName] ),
    FILTER (
        ALLSELECTED ( 'DateTable' ),
        'DateTable'[Fiscal Year]
            = MAX ( 'DateTable'[Fiscal Year] ) - 1
            && 'DateTable'[FY Startno]
                = EOMONTH ( MAX ( 'DateTable'[FY Startno] ), -13 ) + 1
    )
)

Result is as below.

vrzhoumsft_0-1727755887549.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

What is  our expected outcome?  Only consider FY24 Period 1 dates until 8/3/2023 ?

 

Note that 7/1/2023 and 7/1/2024 are not equivalent - they fall on different weekdays. So your comparison will be skewed from the very beginning.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.