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!View all the Fabric Data Days sessions on demand. View schedule
Hello Community,
Can you please help me writing a following DAX Column . I have following calculated column which identify previous product by Date . I need it by Year.
Customer ID | DATE | Product | Previous Product
1 1/Jan/2020 A -
1 2/ Feb/ 2020 B A
1 13 / Jan/ 2021 B -
1 14 / Feb/ 2021 A B
I tried using folloing formula but it is by date : I need it by year
Solved! Go to Solution.
@Anonymous sorry my bad, try this
_prevProd = calculate(max('Table'[Product]),FILTER('Table','Table'[CustID]=EARLIER('Table'[CustID])&&'Table'[_year]=EARLIER('Table'[_year])&&'Table'[Date]<EARLIER('Table'[Date])))
@Anonymous try this
_prevProd = MINX(FILTER('Table','Table'[CustID]=EARLIER('Table'[CustID])&&'Table'[_year]=EARLIER('Table'[_year])&&'Table'[Date]<EARLIER('Table'[Date])),'Table'[Product])
Hi @smpa01 ,
Thankyou so much for the reply.
I am looking continuous previous product. The code you send is producing only first previous product in year.
@Anonymous sorry my bad, try this
_prevProd = calculate(max('Table'[Product]),FILTER('Table','Table'[CustID]=EARLIER('Table'[CustID])&&'Table'[_year]=EARLIER('Table'[_year])&&'Table'[Date]<EARLIER('Table'[Date])))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 17 | |
| 11 | |
| 9 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 25 | |
| 21 | |
| 14 | |
| 12 |