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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
rjsidek
Helper II
Helper II

Getting datediff between initial date and current date

Hi,

I have a dataset that currently looks like this:

 

q1.png

 

The dataset contains multiple entries for each company. For each company, I'm trying to create a measure to return how long it has been since it was entered into the dataset. I know I need to use DateDiff but having trouble creating the var for initial date and current date.

 

For example, the company Jaya Grocer entered the dataset on 10/12/2019, so the measure would return 58 days.

 

Any ideas how I can achieve this? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@rjsidek Please try below measure to get the date diff

Measure = 
VAR _startdate = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table','Table'[Company]))
RETURN DATEDIFF(_startdate,TODAY(),DAY)

If it help accept post as solution.  

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

If you want that a new column and use that to take date diff

 

MINX(filter('Table','Table'[Company]=earlier('Table'[Company]) && 'Table'[Event Date]<earlier('Table'[Event Date])),'Table'[Event Date])

 

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

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

Is there a way to do it without a new column? 

Anonymous
Not applicable

@rjsidek Please try below measure to get the date diff

Measure = 
VAR _startdate = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table','Table'[Company]))
RETURN DATEDIFF(_startdate,TODAY(),DAY)

If it help accept post as solution.  

Hi Vimal,

 

Thanks for the reply. I have created the measure, but it is not retuning the correct date. Plus, when I toggle different company names using a slicer, the visualization just stays the same and does ot change from company to company. Is there a way to correct the DAX?

@rjsidek 

 

The measure seems correct. Check date format and take a look at Change how visuals interact in a report.

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors