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
rogerdea
Helper IV
Helper IV

Average days between dates and locations

I've seen a few topics on this but nothing specific to what i am trying to achieve.

 

What i am trying to do is, for each location in my data, measure the average number of days between dates for each entry by that location.

 

So in the sample data attached, I am trying to build a table visualisation which will list each location, and then give me the average days between each date.  However, there can be duplicate days for each location (which is correct) but if this is the case then the duplicates can be ignored as it doesnt matter how many entries are the same date.

 

So I am aiming for something in a table that looks like:

Telford   5.4 days

Bournemouth  8.1 days

London  9.1 days

 

Does this make sense?  The data is:

 

Sample BI Data.PNG

 

Thanks

1 ACCEPTED SOLUTION

@rogerdea Give this a try.  You will need to change the name of your table in the measure.

Avg Days in Location = 
    AVERAGEX ( 
        VALUES ( 'Table'[Location] ),
        CALCULATE(
            DIVIDE (
                DATEDIFF ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ), DAY ),
                COUNTROWS ( 'Table' ) -1
            )
        )
    )

avgdaysinlocation.jpg

View solution in original post

6 REPLIES 6
Mariusz
Community Champion
Community Champion

Hi @rogerdea 


Can explain the logic behind thous figures.

 

Telford   5.4 days

Bournemouth  8.1 days

London  9.1 days

 

Thanks

Mariusz

The figures were just an example not the expected results, i was just showing how the table would look, rather than the actual averages.  I dont have the answer.. yet!

@rogerdea Can you give us the actual expected result for the data in your screenshot?  

Sure i have just worked them out manually in excel and the results are:

 

Telford = 21

London = 26.6

Bournemouth = 30

 

 

Thanks

@rogerdea Give this a try.  You will need to change the name of your table in the measure.

Avg Days in Location = 
    AVERAGEX ( 
        VALUES ( 'Table'[Location] ),
        CALCULATE(
            DIVIDE (
                DATEDIFF ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ), DAY ),
                COUNTROWS ( 'Table' ) -1
            )
        )
    )

avgdaysinlocation.jpg

Thank you its worked perfectly !

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.