Forum Discussion
Vlookup numbers in a range (power Query)
- Anonymous5 years ago
Hi Anonymous ,
1.You can merge the two tables first, and then add a custom column to calculate the expected return value.
2.Expand the fields you want.
3.Add a custom column to find the region within miles. Then filter the custom column.
4.The result is as follows.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This could be done in the query editor, but it is more suited to DAX, either as a measure or a calculated column. You should do a measure as a first choice and only do columns when needed. However, the measure will depend on the columns used in your visuals, so here is an example of a DAX column expression you can use on your Main table.
Weight =
VAR ThisRegion = Main[Region]
VAR ThisMiles = Main[Miles]
VAR Result =
CALCULATE (
MIN ( Scale[Weight] ),
Scale[Region] = ThisRegion,
Scale[MinMiles] <= ThisMiles,
Scale[MaxMiles] >= ThisMiles
)
RETURN
Result
Pat