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
urspalani
Advocate I
Advocate I

Date difference - When two dates in different rows and columns

Hi,

 

I want to calculate the date difference ,

ED - SD where SD and ED are different Columns and different rows,

 

Capture.PNGAnyone having idea,

 

Thanks,

 

 

 

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@urspalani,

 

Add an index column in Query Editor and a calculated column in DAX.

Column =
VAR ed =
    IF (
        Table1[Type] = "Arr",
        LOOKUPVALUE (
            Table1[ED],
            Table1[Index], Table1[Index] + 1,
            Table1[Type], "Dep"
        )
    )
RETURN
    ed
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-chuncz-msft
Community Support
Community Support

@urspalani,

 

Add an index column in Query Editor and a calculated column in DAX.

Column =
VAR ed =
    IF (
        Table1[Type] = "Arr",
        LOOKUPVALUE (
            Table1[ED],
            Table1[Index], Table1[Index] + 1,
            Table1[Type], "Dep"
        )
    )
RETURN
    ed
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @urspalani

 

Do you have any other columns to link the top 2 rows together (I assumed they are linked), but not to the bottom two?

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

They are linked based on Arr & Dep

So is all the data sequential?  Whats to stop linking the top row from the bottom row?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

This is just a example,

In real time i will get different Report type that is Arr,Dep,ONH,BOSP,EOSP

I have to find the difference always for Arr & Dep ,it will appear in different line not next two each other ,Based on Report type i have find the difference in dates,

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.