Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
95 | |
82 | |
71 | |
64 |
User | Count |
---|---|
115 | |
105 | |
95 | |
79 | |
72 |