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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply

Calculating (No. of days) differences between days two dates from two difference tables.

Hello Guys,

I need help! 

I have 2 columns in the table visualization that came from 2 different tables. I need to compute the number of days difference between the earliest registration_time_id and Earliest time_created_id and its average no. of days. 

power 4.png

 

 Any help will be much appreciated. 

 

Regards,

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Andrew_na_lang ,

 

I think there should be a KeyColumn in both tables to relate them.

Table1:

RicoZhou_0-1649053392069.png

Table2:

RicoZhou_2-1649053413536.png

Measure:

The number of days difference between = 
VAR _MINUTE =
    DATEDIFF (
        MAX ( Table1[Earliest Registration_time_id] ),
        MAX ( Table2[Earliest Time_created_id] ),
        MINUTE
    )
RETURN
    SUMX ( VALUES ( Table1[KeyColumn] ), _MINUTE ) / 60 / 24
Average = 
AVERAGEX(VALUES(Table1[KeyColumn]),[The number of days difference between])

Result is as below.

RicoZhou_3-1649053522995.png

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
amitchandak
Super User
Super User

@Andrew_na_lang , You need to have some common dimension column

Same as this one

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It is more confusing. 

Anonymous
Not applicable

Hi @Andrew_na_lang ,

 

I think there should be a KeyColumn in both tables to relate them.

Table1:

RicoZhou_0-1649053392069.png

Table2:

RicoZhou_2-1649053413536.png

Measure:

The number of days difference between = 
VAR _MINUTE =
    DATEDIFF (
        MAX ( Table1[Earliest Registration_time_id] ),
        MAX ( Table2[Earliest Time_created_id] ),
        MINUTE
    )
RETURN
    SUMX ( VALUES ( Table1[KeyColumn] ), _MINUTE ) / 60 / 24
Average = 
AVERAGEX(VALUES(Table1[KeyColumn]),[The number of days difference between])

Result is as below.

RicoZhou_3-1649053522995.png

 

Best Regards,
Rico Zhou

 

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

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.