Forum Discussion
Anonymous
6 years agoNot applicable
Calculate Day Diff between 2 dates on row level
Hi there, I hope you can help me! I have an issue: I used the table below as an example I am trying to calculate the day difference based on " Change Date " for each Product based on " En...
- Anonymous6 years ago
HI Anonymous
Please check the below code. This gives 1 day as per your need.
CHANGE DATE = DATEDIFF([PHASE],MAXX(FILTER(TABLE,[PRODUCT] = EARLIER(PRODUCT) && [ENTRY] < EARLIER([ENTRY])),[PHASE] ),DAY)
amitchandak
6 years agoSuper User
Anonymous , Not very clear
Try like
datediff(maxx(filter(table,[Product] = earlier(Product ) && [Entry] < earlier([Entry])),[Change Date] ),[Change Date],day)
- Anonymous6 years agoNot applicable
What is expect is the difference in days for each product based on entry no and change date.
Example,
Bike has 3 entry no, the difference in days =
Change date entry no 2 - Change date entry no 3 = (12-8-2020) - (11-8-2020) = 1 day.
This should be dynamic where Power BI takes into consideration the Product, Entry No before calculating the diff date in days.