Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
78 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |