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

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.

Reply
CaveOfWonders
Helper IV
Helper IV

How to use new functions (Window/Offset/Index) to retrieve previous row value based on partition

Hi All,

 

I have been playing around with this but have failed to figure it out. Let's say we have a table like the one below:

ReportDate   Project    Project Phase   Actual Date
01-Dec-2022   a   104-Dec-2022
08-Dec-2022   a   111-Dec-2022
01-Dec-2022   b   402-May-2023
08-Dec-2022   b   403-May-2023

 

and I would like to calculate the previous [Actual Date] based on a partition of [ReportDate], [Project], and [Project Phase], so for example:

 

ReportDate   Project    Project Phase   Actual Date   Previous Actual Date
01-Dec-2022   a   104-Dec-2022 
08-Dec-2022   a   111-Dec-202204-Dec-2022
01-Dec-2022   b   402-May-2023 
08-Dec-2022   b   403-May-202302-May-2023

 

Please note there are multiple reporting periods, multiple projects and multiple phases in the dataset and this is just a subset for ease of undersatnding.

 

How could you do this in a calculated column and how would you do this in a measure and which function (Index/Offset/Window) would be best for this?

 

Thank you for your help on this.

6 REPLIES 6
CaveOfWonders
Helper IV
Helper IV

Hi, thank you for your reply. Unfortunately, this is not working on the actual table.

 

As you can see for project 191, phase 1, the [Actual Date] is '20/Nov/2022' for the [Reporting Date] '17-Nov-2022' , however, for the next reporting date (24-Nov-2022), it is showing 21-Nov-2022 and not the expected 20/Nov/2022.

 

and for the same project in phase 2 it is not working at all?

 

Example.png

and like this?

 

Столбец = 
 ПОИСКЗНАЧЕНИЕ (
     'таблица' [Фактическая дата],
     таблица [Фактическая дата],
         КОМПЕНСИРОВАТЬ (
             -1,
             ПОДВЕДЕМ ИТОГ (
                 ALLSELECTED (таблица),
                 таблица [Фактическая дата]
             ),
             ORDERBY (таблица [Фактическая дата], ASC)
         ),
     'таблица'[ Проект ], 'таблица'[Проект ],таблица[Этап проекта],[Этап проекта]
 )  

 

 

 

 

Sorry, could you send a screenshot of the code as it's coming through in a different language.

This is not working consistently:

 

Example2.png

Ahmedx
Super User
Super User

you can create a column and write like this

 

Столбец =
 ПОИСКЗНАЧЕНИЕ (
     'таблица' [Фактическая дата],
     таблица [Фактическая дата],
         КОМПЕНСИРОВАТЬ (
             -1,
             ПОДВЕДЕМ ИТОГ (
                 ALLSELECTED (таблица),
                 таблица [Фактическая дата]
             ),
             ORDERBY (таблица [Фактическая дата], ASC)
         ),
     'таблица'[ проект ], 'таблица'[проект ]
 ) 

 

Screen Capture #199.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors