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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
PowerBIUser9901
Advocate II
Advocate II

DateDiff with repeating Order ID's

Hi, I’m looking to calculate the difference between two dates in Power BI. I’m aware this is possible with DATEDIFF in DAX however the data I have contains repeating Order ID’s for each Product associated to it. See screenshot below.

Approval_TimeDAX.png

How do I obtain an accurate calculation without recounting the same Order ID’s? Note: The distinct Order ID start and end dates do not change regardless how many products are associated to the ID.

 

Currently I have:

Approval_Time = DATEDIFF(Sheet2[Order_Date], Sheet2[Ship_Date].[Date], DAY)

 

I need to create a visual that is the average of the Approval_Time calculation.

Currently I have:

Average Approval Time in days = AVERAGE(Sheet2[Approval_Time])

However, the issue is that this Average is calculating the repeats. I appreciate any help and guidance with this calculation. 

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

Hi @PowerBIUser9901 ,

 

You need to create a new measure:

NetAvg =
AVERAGEX (
    VALUES ( 'Table'[Order_ID] ),
    CALCULATE ( AVERAGE ( 'Table'[Column] ) )
)

5-1.PNG

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @PowerBIUser9901 ,

 

You need to create a new measure:

NetAvg =
AVERAGEX (
    VALUES ( 'Table'[Order_ID] ),
    CALCULATE ( AVERAGE ( 'Table'[Column] ) )
)

5-1.PNG

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Hi @PowerBIUser9901 ,

 

Follow these steps:

Add this calculated new table:

 

Table 3 = 
    SUMMARIZECOLUMNS(
        'Date diff'[Order ID] ,
        "OD",Max('Date diff'[Order Date ]),
        "SD",MAx('Date diff'[Ship Date]),
       
        "Date Diff" , DATEDIFF(Max('Date diff'[Order Date ]),Max('Date diff'[Ship Date]), DAY)
        )

Create a relationship between your existing Table and a new Table by linking the Order ID.

 

now put the Fields in the Table Visual:

My Output:

Capture11.PNG

 

Let me know if this works.

 

Thanks,

Tejaswi

 

Anonymous
Not applicable

I think the easiest route would be to duplicate your table and use the 'remove duplicates' feature in Power Query. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.