Forum Discussion
Check if value is in range
- 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] )
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]
)
- Rasmus77002 years agoFrequent Visitor
Awesome - that one solved my problem like a charm - Thanks 🙂