Forum Discussion
Anonymous
7 years agoNot applicable
DAX Column days since earliest date
Hi,
I have a table with column [Group] and column [Date]. I'm looking for a DAX formula that finds the earliest date for each group, and then adds a custom column that calculates the difference between that row date and the earliest date value for that group.
So the following table...
Would result in somethign like the following:
Try creating the below measure:
Measure = var FirstDates = CALCULATE(FIRSTDATE(Table1[Date]),ALLEXCEPT(Table1,Table1[Group])) var SelectedDate = CALCULATE(SELECTEDVALUE(Table1[Date]),ALLEXCEPT(Table1,Table1[Date])) return DATEDIFF(FirstDates,SelectedDate,DAY)
1 Reply
- Omega
Impactful Individual
Try creating the below measure:
Measure = var FirstDates = CALCULATE(FIRSTDATE(Table1[Date]),ALLEXCEPT(Table1,Table1[Group])) var SelectedDate = CALCULATE(SELECTEDVALUE(Table1[Date]),ALLEXCEPT(Table1,Table1[Date])) return DATEDIFF(FirstDates,SelectedDate,DAY)