Forum Discussion

fbron's avatar
fbron
Frequent Visitor
3 years ago

Lookupvalue doesnt return expected values

Table 1=  Sales Line Table with rows with a certain weigth.

Table 2 = Warehouse Line table with a certain weight

What I wat to do is create a column in my Sales Line Table (Table 1) containing the weight from the Warehouse Lines 

 

I created a string to connect both tables [Combined]

Since the relationship is 1vsmany LOOKUPVALUE doesnt seem to be the way to go.

 

This is my current situation:

The "Combined" column is where both tables connect.

 

 

 

Is there a way to make LOOKUPVALUE work in this scenario?

 

 

 

 

 

8 Replies

  • Nishudhan's avatar
    Nishudhan
    Frequent Visitor

    Can you please try lookvalue() in the table which has many side of the relationship...it will work

     

     

    • fbron's avatar
      fbron
      Frequent Visitor

      Nishudhan, 

       

      Thank you for the quick response. 

      Unfortunately im in need for the column to be in the sales table. 

       

      Basically what im looking for is that all the wieght from a certain Sales Line is represented in our warehous (warehouse line) the visuals Could be possible that theres no line available in the Warehouse Line Table\

      • amitchandak's avatar
        amitchandak
        Super User

        fbron , A new column

        sumx(filter(Warehouse,Warehouse[Combine] = sales[combine] ) , Warehouse[Weight])

         

        or

         

        Maxx(filter(Warehouse,Warehouse[Combine] = sales[combine] ) , Warehouse[Weight])

  • Hi fbron ,

    If you remove the duplicate from the table 'Warehouse line', it should work.

    Try to create a temporary table using 

    ADDCOLUMNS(

        DISTINCT('Warehouse line'[Combined]),

       "Weight", MAX(Warehouse line'[Weight])

    )

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • fbron's avatar
      fbron
      Frequent Visitor

      mangaus1111 Thank you for the reply.

       

      Followed your suggestion but this resulted in the max weight within the warehouse rowes in each row of the calculated table.  

       

      The idea of a calculated table is something that can work for me. Based on the warehouse lines the preferred outcome would be something like this: