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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ThomasBP
Frequent Visitor

calculate date between install date and todays date

Hi everyone,

This is my first post.
First, thanks to all the community. You are so great ! Thanks to you I improved my PBI skills very fast haha.
Before posting this, I tried to find my answer but I couldn't so ... I hope I did not missed the tip ...

Like the title is saying, I would like to calculate the delta between two dates.
My tab1 came from a SQL request but I'm trying to use as much as possible all opportunities given by PBI so i'm focusing on this.

In one hand I have :  [Date_of_visit] and in the other hand [Date_of_Today]. And I would like a column or something to put in my dashboard like [Day_passedby_since_last_visit]
Indeed:


1/ In first I created a new measure to find the lastest date of visit for each people :
Last visit = CALCULATE(MAX('Table1'[Date_of_visit]); ALL('Table1'[Date_of_visit]))

2/ In the other I created a new column in my data giving me the date of today :
DateTime.LocalNow()

 

The fact is one tab is a measure and the other a created column.
When I try to create a new column for the calcul of the  I can't find the mesure of my last date in the droplist.
When I try to create a new measure I can't find my new column in the options given.

So, could someone give me a trick for this ? 
I know it is pretty simple ... but I don't find any solution for that.

Regards, 
Thomas


2 ACCEPTED SOLUTIONS
v-juanli-msft
Community Support
Community Support

Hi @ThomasBP

If you want to display the [Day_passedby_since_last_visit] in Table2, 

You could try measures in either Table1 or Table2 as below

last_visit2 = CALCULATE(MAX(table1[date_of_visit]),ALLEXCEPT(table2,table2[person_id]))

Current_time = TODAY()

Day_passedby_since_last_visit = DATEDIFF([last_visit2],[Current_time],DAY)

7.png

 

If you want to display the [Day_passedby_since_last_visit] in Table1, 

You could try measures in either Table1 or Table2 as below

last_visit3 = CALCULATE(MAX(table1[date_of_visit]),ALLEXCEPT(table1,table1[person_id]))

Current_time = TODAY()

Day_passedby_since_last_visit2 = DATEDIFF([last_visit3],[Current_time],DAY)
8.png
 
Best Regards
maggie
 

 

View solution in original post

Hello !  

Thanks for the answer ! 
It is workin' fine ! 

I had read that to get the date of today we had to create a new column with the formula "DateTime.LocalNow()"
For now I am using " Today () ". Hope that tomorrow It won't be stuck to 29/11/2018 but will be refresh as  30/11/2018.
What is the difference between both  ?

Have a nice day 🙂
Best regards, 
Thomas

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @ThomasBP

If you want to display the [Day_passedby_since_last_visit] in Table2, 

You could try measures in either Table1 or Table2 as below

last_visit2 = CALCULATE(MAX(table1[date_of_visit]),ALLEXCEPT(table2,table2[person_id]))

Current_time = TODAY()

Day_passedby_since_last_visit = DATEDIFF([last_visit2],[Current_time],DAY)

7.png

 

If you want to display the [Day_passedby_since_last_visit] in Table1, 

You could try measures in either Table1 or Table2 as below

last_visit3 = CALCULATE(MAX(table1[date_of_visit]),ALLEXCEPT(table1,table1[person_id]))

Current_time = TODAY()

Day_passedby_since_last_visit2 = DATEDIFF([last_visit3],[Current_time],DAY)
8.png
 
Best Regards
maggie
 

 

Hello !  

Thanks for the answer ! 
It is workin' fine ! 

I had read that to get the date of today we had to create a new column with the formula "DateTime.LocalNow()"
For now I am using " Today () ". Hope that tomorrow It won't be stuck to 29/11/2018 but will be refresh as  30/11/2018.
What is the difference between both  ?

Have a nice day 🙂
Best regards, 
Thomas

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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