Forum Discussion
Many to Many and Circular Dependency
- 7 years ago
Hi,
This calculated column formula in Table1 works fine
=CALCULATE(MIN(Table2[Repair_Date]),FILTER(Table2,Table2[Serial_Number]=EARLIER(Table1[Serial_Number])&&Table2[Repair_Date]>EARLIER(Table1[Call_Date])))
- 7 years ago
Hi,
Try this calculated column formula
=if(ISBLANK(COUNTROWS(FILTER(Table1,Table1[Serial_Number]=EARLIER(Table1[Serial_Number])&&Table1[Call_Date]>EARLIER(Table1[Call_Date])))),CALCULATE(MIN(Table2[Repair_Date]),FILTER(Table2,Table2[Serial]=EARLIER(Table1[Serial_Number])&&Table2[Repair_Date]>EARLIER(Table1[Call_Date]))),if(CALCULATE(MIN(Table1[Call_Date]),FILTER(Table1,Table1[Serial_Number]=EARLIER(Table1[Serial_Number])&&Table1[Call_Date]>EARLIER(Table1[Call_Date])))-[Call_Date]<=30,BLANK(),CALCULATE(MIN(Table2[Repair_Date]),FILTER(Table2,Table2[Serial]=EARLIER(Table1[Serial_Number])&&Table2[Repair_Date]>EARLIER(Table1[Call_Date])))))
Hope this helps.
Hi,
This calculated column formula in Table1 works fine
=CALCULATE(MIN(Table2[Repair_Date]),FILTER(Table2,Table2[Serial_Number]=EARLIER(Table1[Serial_Number])&&Table2[Repair_Date]>EARLIER(Table1[Call_Date])))
- Anonymous7 years agoNot applicable
Hi Ashish_Mathur, Thanks a Lot!
Your calculated column formula works.Taking the opportunity.
In your formula, Is it possible I can insert a conditional, to not return duplicates [Repair_Date] where the last [Call_Date] is smaller than 30 days?
Like the Example below:
- Ashish_Mathur7 years ago
Super User
You are welcome.
- Ashish_Mathur7 years ago
Super User
Hi,
I do not understand your end result. For BR2, May 5 and May 7 are only 2 days apart. So why should there be a repair date for May 7?
- Anonymous7 years agoNot applicable
Hi Ashish_Mathur,
Thank you for your interest in helping me.
In my example,
BR2 had 2 Call_Date in less than 30 days, so I need to ignore the first date in less than 30 days (May 5).
The same applies for BR0, that has 3 Call_Dates in less than 30 days.
I need to ignore the first and second date (July 6 and 8), because the last date (July 10) is closest to the date of Repair_Date.