Forum Discussion

JeroenN's avatar
JeroenN
Advocate I
8 years ago
Solved

Search for categories between two tables

I have two tables. Table A contains the rent of houses. Table 2 shows the limit values for the rental classes. 

Now I want to add the rental classes to table 1.

So in my example, house 1 falls in Group 4 and house 2 falls in Group2

In Excel this is easily done with the match-function. 

How can I do this in Power BI?

 

AHouseRent
 1602
 2500
 3975
 4650
 5524

 

 

BGroupRentMax
 Group1400
 Group2500
 Group3600
 Group4700

 

Hope you can help me on this!

  • JeroenN's avatar
    JeroenN
    8 years ago

    Thanks Greg!

     

    With one little adjudgment it works perfectly:

    Rent Group = VAR MaxRent = MINX(FILTER(RentGroups,RentGroups[RentMax]>=(Houses[Rent])),RentGroups[RentMax])
    RETURN LOOKUPVALUE(RentGroups[Group],RentGroups[RentMax],MaxRent)

     

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion
    Rent Group = VAR MaxRent = MINX(FILTER(RentGroups,RentGroups[RentMax]>=MAX(Houses[Rent])),RentGroups[RentMax])
    RETURN LOOKUPVALUE(RentGroups[Group],RentGroups[RentMax],MaxRent)

    Nice job with posting the data and what you expect as a result.

    • JeroenN's avatar
      JeroenN
      Advocate I

      Thanks Greg!

       

      With one little adjudgment it works perfectly:

      Rent Group = VAR MaxRent = MINX(FILTER(RentGroups,RentGroups[RentMax]>=(Houses[Rent])),RentGroups[RentMax])
      RETURN LOOKUPVALUE(RentGroups[Group],RentGroups[RentMax],MaxRent)