Forum Discussion

haassiej's avatar
haassiej
Icon for Helper I rankHelper I
9 years ago
Solved

Can't join tables, how retrieve value from another table?

Hi all,   I try to extract a value from a table in power bi, only that does not work.   I have 2 tables: Journal and Procurement   Journals:     Procurement:   I would like to ...
  • P3Tom's avatar
    P3Tom
    9 years ago

    Because, for some rows in Journal there are more than one row with matching IDs, you have to handle multiple possibilities. For example, in your case, it is possible to have one or more matching IDs, so you could create a measure like the following to get the displayed resultss:

     

     

    Here is text for the calculated column that you can copy for the above measure:

     

    NUM from Procurement =
    VAR vRowsWithMatchingIDsInProcurment =
        SUMMARIZE ( FILTER ( Procurement, Procurement[ID] = Journal[ID] ), [NUM] )
    RETURN
        SWITCH (
            COUNTROWS ( vRowsWithMatchingIDsInProcurment ),
            0, BLANK (),
            1, LOOKUPVALUE ( Procurement[NUM], Procurement[ID], Journal[ID] ),
            CONCATENATEX ( vRowsWithMatchingIDsInProcurment, [NUM], ", " )
        )

     

    Remember that this is only one way to handle the different scenarios (for example, maybe instead of concatenating, you want to get the maximum or minimum (top or bottom) NUM.

     

    Tom

    www.PowerPivotPro.com