Forum Discussion
Fidzi8
1 year agoHelper V
Inserting the correct value
Hi comunnity, I need help with this problem. I have two simple tables. The first table contains a list of transports from where - to where (columns "C" - "D") on a given day (column „B“). ...
- 1 year ago
You can create a calculated column in the first table like
Distance = SELECTCOLUMNS ( FILTER ( Table2, Table2[ID] = Table1[ID] && Table2[From] = Table1[From] && Table2[To] = Table2[To] && Table2[Valid From] <= Table1[Date] && ( ISBLANK ( Table2[Valid To] ) || Table2[Valid To] >= Table1[Date] ) ), "@value", Table2[Distance] ) - 1 year ago
Try
Distance = SELECTCOLUMNS ( TOPN ( 1, FILTER ( Table2, Table2[ID] = Table1[ID] && Table2[From] = Table1[From] && Table2[To] = Table2[To] && ( ( Table2[Valid From] <= Table1[Date] && Table2[Valid To] >= Table1[Date] ) || ( ISBLANK ( Table2[Valid To] ) && ISBLANK ( Table2[Valid From] ) ) ) ), Table2[Value To], DESC ), "@value", Table2[Distance] )
johnt75
1 year agoSuper User
Try
Distance =
SELECTCOLUMNS (
TOPN (
1,
FILTER (
Table2,
Table2[ID] = Table1[ID]
&& Table2[From] = Table1[From]
&& Table2[To] = Table2[To]
&& (
( Table2[Valid From] <= Table1[Date]
&& Table2[Valid To] >= Table1[Date] )
|| ( ISBLANK ( Table2[Valid To] ) && ISBLANK ( Table2[Valid From] ) )
)
),
Table2[Value To], DESC
),
"@value", Table2[Distance]
)