Forum Discussion
Donny620
Helper I
3 years agoDifference in date between two columns in a measure?
Hello! I have an Excel version of this that I am trying to duplicate in PBI. I have three date columns Date 1a(stock date), Date1b(different stock date), and Date 2(sell date). I want to use Da...
- 3 years ago
Donny620 you can add a measure like this:
Trimmed Aging = VAR __Date1 = COALESCE ( SELECTEDVALUE ( Table[Date1] ), Table[Date2] ) VAR __Date2 = SELECTEDVALUE ( Table[Date2] ) VAR __Diff = DATEDIFF ( __Date1, __Date2, DAYS ) RETURN IF ( __Diff < 5, 5, IF ( __Diff > 540, 540, __Diff ) )
parry2k
Super User
3 years agoDonny620 did you look at pbix file with the solution, I used a different approach and you should follow the same.
Donny620
Helper I
3 years agoHi I did thank you, that's where I got the formula (I tweaked it) for the measure I copied below. In your file I see a measure called "Trimmed Aging" (below) and I see a calculated column called "days in invnetory trimmed - fixed". Because my data is just a bunch of SQL tables, or perhaps because of access issues, I cannot create any columns, only measures. That's why I was hoping for a measure-only solution. 😞 Do you think this is possible? Thanks again!