Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
seanpatten11
Regular Visitor

How to retrieve previous row in the same table

Hi, I have the following table structure and would like to create a calculated column based on the previous months sales for that sales person and I constantly get "Multiple rows are returned", please see structure and formula below:

DateSalesPersonSalesFigure
01/01/2017Sales1100
01/01/2017Sales2100
01/01/2017Sales3100
01/02/2017Sales1200
01/02/2017Sales2200
01/02/2017Sales3200
01/03/2017Sales1300
01/03/2017Sales2300
01/03/2017Sales3300

 

 Formula:

PreviousMonthsValue = LOOKUPVALUE(Table[SalesFigure], Table[SalesPerson], VALUE(Table[SalesPerson]), Table[Date], DATEADD (Table[Date], -1,  MONTH))

Does anyone have any ideas i can try?

Many thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @seanpatten11,

 

You can try to use below formula to get the previous month data.

PreviousMonthsValue = 
LOOKUPVALUE(Table1[SalesFigure],[SalesPerson],[SalesPerson],[Date],DATE([Date].[Year],[Date].[MonthNo]-1,[Date].[Day]))+0

4.PNG

 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

Try this calculated column formula

 

=CALCULATE(MAX([SalesFigure]),FILTER(Table1,[Date]<EARLIER([Date])&&[SalesPerson]=EARLIER([SalesPerson])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @seanpatten11,

 

You can try to use below formula to get the previous month data.

PreviousMonthsValue = 
LOOKUPVALUE(Table1[SalesFigure],[SalesPerson],[SalesPerson],[Date],DATE([Date].[Year],[Date].[MonthNo]-1,[Date].[Day]))+0

4.PNG

 

Regards,

Xiaoxin Sheng

That works! Thankyou very much! 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.