Forum Discussion
Match two tables with multiple criteria
- Anonymous6 years ago
Hi Anonymous ,
Sorry for the delay.
Please modify the measures as below:
Measure = VAR a = CALCULATE ( MIN ( Merge1[Job perform date] ), FILTER ( ALL ( Merge1 ), Merge1[Vessel] = MAX ( Merge1[Vessel] ) && Merge1[Destination Port] = MAX ( Merge1[Destination Port] ) ) ) VAR b = IF ( ISBLANK ( MAX ( Merge1[Job perform date] ) ), BLANK (), IF ( MAX ( Merge1[Sailing Date] ) > MAX ( Merge1[Job perform date] ), "NA", IF ( MAX ( Merge1[Job perform date] ) <> a && MAX ( Merge1[Sailing Date] ) < a, "NA", a ) ) ) RETURN IF ( ISBLANK ( b ), 1, IF ( b = "NA", 0, IF ( DATEDIFF ( MAX ( Merge1[Sailing Date] ), MAX ( Merge1[Job perform date] ), MONTH ) > 2, 1, 0 ) ) )Measure 2 = SUMX(Merge1,[Measure])Result would be shown as below:
BTW, Pbix as attached, hopefully works for you.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
I tried to re-pro the issue from my end and uploaded the file.
3rd creteria, i am not clear. so tried to do it upto days wise data.
If you have any concerns, please let us know.
If this post helps, then please consider Accept it as the solution to help the other members find it more
If this post was helpful may I ask you to mark it as solution and click on thumb symbol?
- Anonymous6 years agoNot applicable
Thanks venal , it's a good idea but the base we should use is Voyage table not Job table to do the merge.
However, Merge method doesnt really solve the issue because it will create duplicate rows after merging.
For example as below, it will create duplicate two rows (Vessel B, Port FSD and same Sailing Date), however my objective is to only showing the earliest Job perform date which is April 4th 2019, not together with April 6th 2019. Do you have any idea how to resolve this? Thansks.
Vessel Destination Port Sailing Date (mm/dd/yyyy) Job.Vessel Job.Loading Port Job.Job perform date (mm/dd/yyyy) B FSD 3/5/2019 B FSD 4/6/2019 B FSD 3/5/2019 B FSD 4/4/2019