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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Cevola
Frequent Visitor

How to compare the count on a given day to the count in the previous year same day

I need to compare the count on a given day to the count in the previous year same day. Compare the data of 5 Mar 2023 to 5 March 2023. How can i achieve this in DAX.

1 REPLY 1
tamerj1
Super User
Super User

HI @Cevola 

Count Previous Year = CALCULATE ( [Count], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )

If no Date table then

Count Previous Year =
VAR CurrentDate = MAX ( 'Table'[Date] )
RETURN
    CALCULATE ( [Count], 'Table'[Date], = DATE ( YEAR ( CurrentDate ) - 1, MONTH ( CurrentDate  ), DAY ( CurrentDate  ) ) )

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors