Forum Discussion
Measure to filter days between operations
- 6 years ago
Hi Tommyvhod ,
Try these two measures to get the result in the picture. My table name is Fin.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielDate diff = VAR _Time = ( Fin[Finish date] ) //captures current date Var _maxLastTime = CALCULATE(MAX(Fin[Finish date]),FILTER(ALLEXCEPT(Fin,Fin[ID ]),Fin[Finish date]< _Time)) var _datedif =DATEDIFF(_maxLastTime,Fin[Finish date],day) return if(_datedif>0,_datedif,0) ================== Date Dif per ID = CALCULATE(DATEDIFF(MIN(Fin[Finish date]),MAX(Fin[Finish date]),DAY),Filter(ALLEXCEPT(fin,Fin[ID ]),Fin[ID ])
Could I ask how did you merged the Time and date column together? I simply added a new column and added the formula Date + Time. I received a format that seems to be ok. but when changed the measure formula, pointing to the combined date, all my datediff numbers switched to 74.
Hi Tommyvhod ,
Here is my pbix DATEDIFF
Go to Power Query, select both columns, select Merge Columns, with space for a delimiter, and then change type of the new column to Date Time.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel