Forum Discussion
D_PBI
Post Partisan
3 years agoHow to count days between two dates grouped by two attributes?
Hi. Please view the below example table, which also includes the desired result to the right. You will notice each ID has mutiple Statuses and each have their own Start Date and End Date. I need to...
- 3 years ago
Hi D_PBI ,
If I understand your issue, please try this.
My example:Period = Var _id = MAX('Status'[ID]) Var _series = MAX('Status'[Series]) var _MinDate = CALCULATE(min('Status'[Start Date]),FILTER(All('Status'),'Status'[ID]= _id && 'Status'[Series]=_series)) var _MaxEndDate = CALCULATE(MAX('Status'[End Date]),FILTER(All('Status'),'Status'[ID]= _id && 'Status'[Series]=_series)) var _dateDif= DATEDIFF(_MinDate,_MaxEndDate,DAY) Return _dateDif
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
D_PBI
Post Partisan
3 years agoNathaniel_C - Perfect. Thank you very much.
Nathaniel_C
Community Champion
3 years agoD_PBI ,
You are very welcome!
Nathaniel