Forum Discussion
Power Query code for lookup value in a range in another table and return text from that table
- 3 years ago
Hi KasperJ90 ,
According to your description, here's my solution.
1. Power Query.
Add a custom column in Prod Line table.
Table.SelectRows(Range,(x)=> x[Operation From]<=[No_] and x[Operation To] >=[No_])[Minute Type]Then expand the column, get the correct result.
2. DAX
Create a calculated column in Prod Line table.
Column = MAXX ( FILTER ( 'Range', 'Range'[Operation From] <= EARLIER ( 'Prod Line'[No_] ) && 'Range'[Operation To] >= EARLIER ( 'Prod Line'[No_] ) ), 'Range'[Minute Type] )Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi KasperJ90 ,
According to your description, here's my solution.
1. Power Query.
Add a custom column in Prod Line table.
Table.SelectRows(Range,(x)=> x[Operation From]<=[No_] and x[Operation To] >=[No_])[Minute Type]
Then expand the column, get the correct result.
2. DAX
Create a calculated column in Prod Line table.
Column =
MAXX (
FILTER (
'Range',
'Range'[Operation From] <= EARLIER ( 'Prod Line'[No_] )
&& 'Range'[Operation To] >= EARLIER ( 'Prod Line'[No_] )
),
'Range'[Minute Type]
)
Get the correct result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.