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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
Below is my sample data,
I need to find the immediate previous sales of each product using sales date. The last 'Previous Sales Amount' column is all i need to calculate as a calculated column. For ex: For Product 'A' and sales date '10-01-2020', Sales Amount 1000 is the immediate previous sales this Product.
Thanks in Advance....
Solved! Go to Solution.
@Anonymous ,
As a new column
New column =
var _max = maxx(filter(Table, [product] =earlier([product]) && [Sales date] < earlier([Sales date])),[Sales date])
return
maxx(filter(Table, [product] =earlier([product]) && [Sales date] =_max ),[Sales Amount])
As new measure with help from date table
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
@Anonymous ,
As a new column
New column =
var _max = maxx(filter(Table, [product] =earlier([product]) && [Sales date] < earlier([Sales date])),[Sales date])
return
maxx(filter(Table, [product] =earlier([product]) && [Sales date] =_max ),[Sales Amount])
As new measure with help from date table
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |