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
arnabmit
Helper I
Helper I

Can SAMEPERIODLASTYEAR be used inside or along with FILTER?

Hi all,


I feel like I am missing something very obvious but can't put my finger on it. Any help would be greatly appreciated.


My first measure is this:

Closed = CALCULATE(
    DISTINCTCOUNTNOBLANK(
        Fact[Case ID]
    ),
    FILTER(
        Fact,
        Fact[Categories] = "New" && SUM(Fact[Revenue])>0
    ),
)

This counts the number of "New" cases where Revenue is +ve.

 

Then I tried to do the same thing for last year, but getting a blank:

Closed LY = CALCULATE(
    DISTINCTCOUNTNOBLANK(
        Fact[Case ID]
    ),
    FILTER(
        Fact,
        Fact[Categories] = "New" && SUM(Fact[Revenue])>0
    ),
    SAMEPERIODLASTYEAR(Calendar[Date])  
)

Please help!

1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

Try

 

Closed LY = 
   CALCULATE(
       [Closed],
       SAMEPERIODLASTYEAR(Calendar[Date])
   )

View solution in original post

2 REPLIES 2
lukiz84
Memorable Member
Memorable Member

Try

 

Closed LY = 
   CALCULATE(
       [Closed],
       SAMEPERIODLASTYEAR(Calendar[Date])
   )

Thank you so much! I feel like kicking myself now 😁

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.