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

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
Community Support Team
Community Support Team

Re: Need help with Same Period Last Year

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.