Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
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])))
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 13 | |
| 9 | |
| 9 | |
| 8 | |
| 8 |