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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DavidM06
Regular Visitor

Impossible to use SAMEPEDIODASLASTYEAR and filter at the same time

morning all

believe it or not, i did not find the solution here...:)

i have a Clustered Column chart with values forlast 6 months , based on "SignatureDate". to get these values, I use a filter on SignatureDate for the last 6 months.

I created a measurement to get the same numbers last years

LY = CALCULATE(SUM(Haraka[TCV]),SAMEPERIODLASTYEAR(CRM[DateSignature].[Date]))
 Goal : compare the number of this years with the numbers of last year at the same period
The problem is that the LY measureemtn are also impacted by the filter, and are not displayed cause the SignatureDate is more than 6 months !!!
Any idea to filter my number AND NOT  the LY ones ?
thnaks
DAvidM
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DavidM06 ,

 

Here I add a range [Date]<=_RANGESTART && [Date]>=_RANGEEND in my FILTER. So we don't need to use SAMEPERIODLASTYEAR in our code.

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @DavidM06 ,

 

Here I suggest you to try ALL() code to create a measure.

LY =
VAR _RANGESTART =
    EOMONTH ( MAX ( CRM[DateSignature] ), -13 ) + 1
VAR _RANGEEND =
    EOMONTH ( MAX ( CRM[DateSignature] ), -12 )
RETURN
    CALCULATE (
        SUM ( Haraka[TCV] ),
        FILTER (
            ALL ( CRM ),
            CRM[DateSignature] >= _RANGESTART
                && CRM[DateSignature] <= _RANGEEND
        )
    )

 

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.

thanks, but where is the SAMEPERIODLASTYEAR parameter ?

Anonymous
Not applicable

Hi @DavidM06 ,

 

Here I add a range [Date]<=_RANGESTART && [Date]>=_RANGEEND in my FILTER. So we don't need to use SAMEPERIODLASTYEAR in our code.

 

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.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.