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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
StillLearningMe
Frequent Visitor

Lead Time when dates in different rows and columns

I've been struggling for days to figure this out so I'm hoping someone here can help me with a fresh set of eyes.

 

I've got a table where one date is on a different row and a different column to another date. However I want to show the lead time between those 2 dates.

 

I have it similar to this:

 

IDIndex1st date2nd date3rd date
11NullNull28/4/2022
21Null3/4/2022Null
311/1/2022NullNull
42

Null

Null2/2/2022
52Null29/12/2021Null
6220/12/2021NullNull

 

I want to be able to show the lead time between "1st date" and "2nd date" and also on the same graph be able to show lead time between "2nd date" and "3rd date".

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @StillLearningMe 

 

One way is to summarize your table, use the following DAX code to create a new table:

Table 2 = 
SUMMARIZE (
    'Table',
    'Table'[Index],
    "1st date", MIN ( 'Table'[1st date] ),
    "2nd date", MIN ( 'Table'[2nd date] ),
    "3rd date", MIN ( 'Table'[3rd date] )
)

 

Output:

VahidDM_0-1651025072124.png

 

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @StillLearningMe 

 

One way is to summarize your table, use the following DAX code to create a new table:

Table 2 = 
SUMMARIZE (
    'Table',
    'Table'[Index],
    "1st date", MIN ( 'Table'[1st date] ),
    "2nd date", MIN ( 'Table'[2nd date] ),
    "3rd date", MIN ( 'Table'[3rd date] )
)

 

Output:

VahidDM_0-1651025072124.png

 

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Index", Int64.Type}, {"1st date", type date}, {"2nd date", type date}, {"3rd date", type date}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID", "Index"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"ID"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Value")
in
    #"Pivoted Column"

Hope this helps.

Untitled.png


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

Yes, thank you. That helped perfectly.

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.

Top Solution Authors
Top Kudoed Authors