Forum Discussion
Days between dates of same column using DAX
- Anonymous2 years ago
Hi POSPOS ,
Please try:Column = VAR _cur_protocol = 'export'[Protocol Number] VAR _cur_index = 'export'[Index] VAR _next_index = CALCULATE(MIN('export'[Index]),FILTER(ALL('export'),'export'[Protocol Number]=_cur_protocol && 'export'[Index]>_cur_index)) VAR _next_date = CALCULATE(MIN('export'[Status Date]),ALLEXCEPT('export','export'[Index]),'export'[Index]=_next_index) VAR _result = COALESCE(DATEDIFF('export'[Status Date],_next_date,DAY),0) RETURN _resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Sure. I re-downloaded the pbix file... but no index column was there.
Data-estDog - Please find the file here.
- Anonymous2 years agoNot applicable
Hi POSPOS ,
Please try:Column = VAR _cur_protocol = 'export'[Protocol Number] VAR _cur_index = 'export'[Index] VAR _next_index = CALCULATE(MIN('export'[Index]),FILTER(ALL('export'),'export'[Protocol Number]=_cur_protocol && 'export'[Index]>_cur_index)) VAR _next_date = CALCULATE(MIN('export'[Status Date]),ALLEXCEPT('export','export'[Index]),'export'[Index]=_next_index) VAR _result = COALESCE(DATEDIFF('export'[Status Date],_next_date,DAY),0) RETURN _resultBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group