Forum Discussion
Date difference based on condition
- 6 years ago
Hi tejapowerbi123 ,
You could try below measure and refer to my sample for details
Measure 2 = IF(MIN(TA[ID])=MIN(TB[ID]), DATEDIFF(MIN(TA[DATE]), MIN(TB[DATE]), DAY), BLANK())Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tejapowerbi123 not very clear what would be the output, if there are dates in two tables and it is one row and what would be the average, isn't it is just a datediff? why you are using average?
Hi Parry,
Thank you so much for your suggestion.
Please ignore AVERAGE,I am looking for day difference and it is not working.
Do you have any suggestion for me?
Thanks
- parry2k6 years ago
Super User
tejapowerbi123 try this, assuming you are adding a new column in Table A, if you are adding a new column in Table B then use RELATED function with Table A
Date Difference = If (table a[id]=RELATED(table b[id]),datediff(table a[date],RELATED(table b[date]),day))I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- tejapowerbi1236 years ago
Helper V
Hi Parry,
Formula is working fine but still i am not getting any result.
What i found in TABLE B date column has multiple blank (Date is not available).
Do you think because of that i am not getting right result.
Thanks
- parry2k6 years ago
Super User
tejapowerbi123 of course if it is a blank date, you will not get the result. I cannot speak about your data, you have to test the logic where a date is available, not sure what else to say.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡