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
Hystericred
Frequent Visitor

SUMX This Year (Leap Year) vs Last Year (Not a Leap Year) that match exactly Day of Weeks

Im trying to do it like this :

Total Revenue LY for 2020 (Net Amount):=
                   CALCULATE([Total Revenue (Net Amount)],
                              DATEADD('dRollingCalendar_2018 to Now'[date],-364,DAY
                                )
                    )
But the result doesn't seems to match DOW , pls helps : (

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

Hi,

 

You can try this measure(without other calender table):

Total Revenue LY for 2020 (Net Amount) =
CALCULATE (
    [Total Revenue (Net Amount)],
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date]
            = DATE ( YEAR ( MAX ( 'Table'[Date] ) ) - 1, MONTH ( MAX ( 'Table'[Date] ) ), DAY ( MAX ( 'Table'[Date] ) ) )
    )
)

Hope this helps.

If you still have any issue, please share some sample data and expected result as screenshots here.

Thanks!

 

Best Regards,

Giotto 

 

View solution in original post

3 REPLIES 3
v-gizhi-msft
Community Support
Community Support

Hi,

 

If my answer has solved your issue, please mark it as a solution for others to see.
Thanks!

 

Best Regards,

Giotto

v-gizhi-msft
Community Support
Community Support

Hi,

 

You can try this measure(without other calender table):

Total Revenue LY for 2020 (Net Amount) =
CALCULATE (
    [Total Revenue (Net Amount)],
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Date]
            = DATE ( YEAR ( MAX ( 'Table'[Date] ) ) - 1, MONTH ( MAX ( 'Table'[Date] ) ), DAY ( MAX ( 'Table'[Date] ) ) )
    )
)

Hope this helps.

If you still have any issue, please share some sample data and expected result as screenshots here.

Thanks!

 

Best Regards,

Giotto 

 

amitchandak
Super User
Super User

@Hystericred 

This one seems correct. The same weekday is always 364 days behind. But the same day would be 1 year behind

Total Revenue LY for 2020 (Net Amount) same Week day:=
CALCULATE([Total Revenue (Net Amount)],
DATEADD('dRollingCalendar_2018 to Now'[date],-364,DAY
)
)

Total Revenue LY for 2020 (Net Amount) Same day:=
CALCULATE([Total Revenue (Net Amount)],
DATEADD('dRollingCalendar_2018 to Now'[date],-1,Year
)
)

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.