Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
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 ) ) )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 8 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 29 | |
| 19 | |
| 17 | |
| 11 | |
| 10 |