cancel
Showing results for
Did you mean:
Helper III

## To find previous sales

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.

1 ACCEPTED SOLUTION
Super User IV

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.

Proud to be a Super User!

Super User IV

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.

Proud to be a Super User!

Announcements

#### 2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

#### Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors