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
imaddrell
Advocate II
Advocate II

Need help with Same Period Last Year

Hi All

 

I have worked out a measure to sum a column of sales for the same period in a prior year, in my case this is the same quarter last year and a calculation of sales in the prior quarter. This works fine.

 

But as I have rows of sales in the same period in the prior year, I would like to flag those rows of revenue as opposed to creating a measure to summarise them.

 

I want to show this flag on my table called "sales", this row was in the same date period of the prior year.

 

Any ideas? I know I need a calculated column as opposed to a measure. I have a linked date table to work out dates called "DateKey".

 

Thanks

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @imaddrell

 

You may try to use EARLIER Function in calculated column. If it is not your case, please share some data sample and expected output. For example:

 

PeriodLastYear =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER (
        Sales,
        YEAR ( Sales[Date] )
            = YEAR ( EARLIER ( Sales[Date] ) ) - 1
            && MONTH ( Sales[Date] ) = MONTH ( EARLIER ( Sales[Date] ) )
            && DAY ( Sales[Date] ) = DAY ( EARLIER ( Sales[Date] ) )
    )
)

1.png

Regards,

Cherie

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

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.