Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I have a dataset that currently looks like this:
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?
Solved! Go to Solution.
@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.
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
Is there a way to do it without a new column?
@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?
The measure seems correct. Check date format and take a look at Change how visuals interact in a report.