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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 55 | |
| 52 | |
| 42 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 107 | |
| 104 | |
| 39 | |
| 35 | |
| 25 |