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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi - I need to calculate same day last year's sales in a calculated column. Any help on this is highly appreciated.
Using first three column, I need to create a calculated column to have output column as Calculated Column.
| Date | Product | Sales Amount | Output Column |
| 1-Jan-19 | A | 9837 | 0 |
| 2-Jan-19 | A | 5784 | 0 |
| 3-Jan-19 | B | 16901 | 0 |
| 4-Jan-19 | B | 18360 | 0 |
| 5-Jan-19 | C | 17535 | 0 |
| 1-Jan-20 | A | 6649 | 9837 |
| 2-Jan-20 | A | 6768 | 5784 |
| 3-Jan-20 | B | 24625 | 16901 |
| 4-Jan-20 | B | 6525 | 18360 |
| 5-Jan-20 | C | 19379 | 17535 |
Solved! Go to Solution.
Try the below DAX
Same Day Last Year =
VAR _previousYearDate =
DATE ( YEAR ( [Date] ) - 1, MONTH ( [Date] ), DAY ( [Date] ) )
VAR _result =
MAXX (
FILTER (
'Table',
'Table'[Product]
= EARLIER ( 'Table'[Product] )
&& [Date] = _previousYearDate
),
[Sales Amount]
)
RETURN
_result
Thank you for this.
Try the below DAX
Same Day Last Year =
VAR _previousYearDate =
DATE ( YEAR ( [Date] ) - 1, MONTH ( [Date] ), DAY ( [Date] ) )
VAR _result =
MAXX (
FILTER (
'Table',
'Table'[Product]
= EARLIER ( 'Table'[Product] )
&& [Date] = _previousYearDate
),
[Sales Amount]
)
RETURN
_result
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 48 | |
| 35 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 94 | |
| 79 | |
| 38 | |
| 27 | |
| 25 |