Forum Discussion
Anonymous
6 years agoNot applicable
Match two tables with multiple criteria
Hi, I'm facing a problem to map values between two tables. Basically there are two tables, one is "Voyage" and the other one is "Job", and my objective is to see how many jobs we didn't manag...
- 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
6 years agoNot applicable
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
6 years agoNot applicable
Thanks Jay, exactly what I need!