Forum Discussion
Rasmus7700
2 years agoFrequent Visitor
Check if value is in range
Hello Guys. looking around and read a lot of posts - but can't find one that fits my needs completely... I have two tables, one called "structure" and another called "posts" in the "struct...
- 2 years ago
Rasmus7700 the logic you explained doesn't make sense in the example. for 225, you want to take the value from 999 from the upper bound, whereas in another example for 2500, you want the value from the lower band. I think the logic should be identical in both cases, no?
Anyhow try using this new INDEX function and see if it gets you what you are looking for.
Description Column in Post Table = VAR __Post = 'Post'[Post] RETURN SELECTCOLUMNS ( INDEX ( 1, FILTER ( ALL ( 'Structure' ), 'Structure'[Key] <= __Post ), ORDERBY ( 'Structure'[Key], DESC ) , MATCHBY ( 'Structure'[Key] ) ), "@Desc", [Desc] )
az38
2 years agoCommunity Champion
Hi Rasmus7700
you can create a calculated column
Column =
var __lookupKey = CALCULATE(MIN('structure'[key]), 'structure'[key] >= EARLIER('post'[key]))
var __result = LOOKUPVALUE('structure'[description], 'structure'[key], __lookupKey)
RETURN
__result
Make sure, your post and structure table has no relationships