cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
paulj1 Frequent Visitor
Frequent Visitor

Grid Matrix Lookup and match

Hello, help me please, my brain hurts......

 

I have a product table, extract below, each product has a size (4.68) and a quality grade (B)

 

Trying to do a calculated column to do a lookup on the grid, rounding down 4.68 to 4.6, and looking in column B, returning the cardinal intersect value of 55.

 

This must be able to be done in Power BI, help please.

 

Thanks in advance

 

Paul

 

 

Lookup1.JPGGrid_LI.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Grid Matrix Lookup and match

HI @paulj1,

 

You can enter to query editor and use unpivot columns function to transform your table as attribute and value columns.

Power Query Unpivot Scenarios

 

16.gif

 

Then write formula to formual your area column:

Format = 
VAR temp =
    ROUNDDOWN ( [Area], 1 )
RETURN
    IF (
        temp IN VALUES ( Grid[Size [m2]]] ),
        temp,
        MAXX ( FILTER ( ALL ( Grid ), Grid[Size [m2]]] < temp ), Grid[Size [m2]]] )
    )

3.PNG

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
4 REPLIES 4
Community Support Team
Community Support Team

Re: Grid Matrix Lookup and match

HI @paulj1,

 

I think lookupvalue with rounddown functions will suitable for your requirement, please take a look at below formula.

 

Calculate column on Product table:

Lookup =
LOOKUPVALUE ( Grid[B], Grid[Hide Size], ROUNDDOWN ( Product[area], 1 ) )

 

Reference:

ROUNDDOWN Function (DAX)

LOOKUPVALUE Function (DAX)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
paulj1 Frequent Visitor
Frequent Visitor

Re: Grid Matrix Lookup and match

Doesnt seem to work.  Explaining how i do it in excel...

 

1. the lookup area numeric may not be in the grid, for example in excel when I use VLOOKUP by putting TRUE at the end it will return the nearest. e. 3.2 will use row with 0, 5.22 will use row of 5.2, 5.99 will use row of 5.9

2. Once row is established, then use MATCH to cross reference the column number, eg. 2 will return column number 3, 3 will return column number 4 etc

3. I use the result of the MATCH function in the VLOOKUP to "pick" the correct result

 

How do i do this in POWER BI....

 

 

 

Capture3.JPG

 

 

I could colapse the table into a simpler table and then lookup.... by combining fields, in POWERBI how do i create this reference table, appending columns below each other ???Capture4.JPG

 

 

 

My brain hurts....

 

Thanks in advance for any wise words

 

Paul

 

Community Support Team
Community Support Team

Re: Grid Matrix Lookup and match

HI @paulj1,

 

You can enter to query editor and use unpivot columns function to transform your table as attribute and value columns.

Power Query Unpivot Scenarios

 

16.gif

 

Then write formula to formual your area column:

Format = 
VAR temp =
    ROUNDDOWN ( [Area], 1 )
RETURN
    IF (
        temp IN VALUES ( Grid[Size [m2]]] ),
        temp,
        MAXX ( FILTER ( ALL ( Grid ), Grid[Size [m2]]] < temp ), Grid[Size [m2]]] )
    )

3.PNG

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
paulj1 Frequent Visitor
Frequent Visitor

Re: Grid Matrix Lookup and match

Thank you Xiaoxin Sheng  Smiley Happy

 

i had done the unpivot, and was using a complicated if statement, but your solution is better.