Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
arpost
Advocate V
Advocate V

What is the most performant way to check if a value is lower than a value in another table?

I have a set of targets and a range of values I need to check against my target table list. These are in two separate tables like below:

Range Table

PeriodStartEnd
0-6 Months16
7-12 Months712
13-24 Months1324

Sample Table

ItemMonth
Clothes3
Shoes5
Food7

 

With this example, I'd want to check and see if Clothes is less than or equal to the End value and return the first matching end value. These values can change, so I can't use a typical Conditional Column. I'm open to either DAX or M Query but need the result to be as follows:

 

ItemMonthPeriod
Clothes30-6 Months
Shoes50-6 Months
Food77-12 Months

Thanks in advance.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@arpost , a new column in the sample table

 

MAxx(filter(Range, Range[start] <= Sample[Month] && Range[end] >= Sample[month]), Range[period])

 

 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@arpost , a new column in the sample table

 

MAxx(filter(Range, Range[start] <= Sample[Month] && Range[end] >= Sample[month]), Range[period])

 

 

 

@amitchandak, hello again! Any chance you know of a way to accomplish this same result in Power Query? The reason I ask is I'm now needing to use this same approach on a DirectQuery dataset, and DQ doesn't support cross-table functions with calc. columns. 😭

Brilliant, @amitchandak! Worked like a charm. Thanks for that!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.