Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Check ID in another table

Hi,

 

I have two tables related with each other with an ID number (many to one). From the one side I want to check in the column of the many table if the ID exists in this table (specific column). If the ID is there, the ID is packed. If the ID is not in the table, the ID is unpacked.

 

I checked historical solutions related to the problem, but could not find the solution unfortunately.

 

Can somebody help?

3 Replies

  • Anonymous try this measure

     

    Measure Packed = 
    IF ( COUNTROWS( ManySideTable ) == BLANK(), "Not packed", "Packed" )

     

    drop ID from parent table and above measure in a table visual and you will have the solution 

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario.

    OneSideTable:

    ManySideTable:

     

    Relationship:

     

    Then You may create a measure as follows.

     

    Ispacked = 
    IF(
        COUNTROWS(
            RELATEDTABLE(ManySideTable)
        )>0,
        "packed",
        "unpacked"
    )

     

     

    Finally you may use a table visual to display the result.

     

    Best Regards

    Allan

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Thanks for you help. However I get no detailed view of packed lines. ID's are empty (on both formulas you suggested). Data link is based on direct query.