Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Find the value based on Comma seperated list

I have a Table - 1 with a path (comma seperated value) of everyone who reports to someone

Table 1 Column1 - value A,B,C

example : A,B,C where A and B reports to C

 

Another Table , Table 2 which  has a value of C

ColumnName  = Level Value C

ColumnName = Person

ColumnName = Amount

 

I need Table 2 to to look into table 1 and get the values of both A and B and then display them

Also , the "Amount" column from table 2 where Table1Column1 = Table2Columnname Person

 

 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    For table1 , you could split the delimitted collumn into more/other columns.

    Go to edit query >> Right click the column >> Split Column (By Delimiter)

    This will create a table with 3 columns. A,B,C --> A | B | C

    Create another custom column to concatenate all values that are not reported to.

    A | B | C --> A | B | C | A, B

     

    Split:

    Result:

    In table2 you can create a look up to match the reporting to values and retreive the concatenated column.

     

    Not sure what you need with the amount.

     

    Cheers!
    A

    • belisqui's avatar
      belisqui
      Advocate IV

      I believe you need to create a bridging_table to link table A to B.

       

       It will involve the split solution proposed by Anonymous . but would be better off creating it in a referenced table and pivoting the result to link to use it as a link.

       

      Something like this:

       

       

       

       

       

       

    • Anonymous's avatar
      Anonymous
      Not applicable

      That might not work in my case.

      Is there a DAX I could use to find/Search the column .. Since the value in column 1 will always be as one of the values  in the comma seperated value.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hey Anonymous 

        As I understand, the value to search will always be in the last column.

        A,B,C so you want to find 'C'
        C,D so you want to find 'D'

        D so there is no one to find, as D is not reporting to anyone.

         

        Bottom line,

        The way the values are ordered, is the key to finding the values later on.

         

        Cheers!
        A

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

    Hi Anonymous ,

     

    We can create this column in tables to show who to report.

     

    Report man = 
    MAXX (
        Table2,
        IF (
            FIND ( [Level], [Column1], 1, -1 )
                = (
                    LEN ( [Column1] ) - LEN ( [Level] ) + 1
                ),
            [Level]
        )
    )

     

    Then we can create such column to show the sub people.

     

    Sub People =
    VAR t =
        FILTER ( 'Table', [Level] = [Report man] )
    VAR result =
        MAXX (
            t,
            REPLACE (
                [Column1],
                LEN ( [Column1] ) - LEN ( [Level] ),
                LEN ( [Level] ) + 1,
                ""
            )
        )
    RETURN
        SUBSTITUTE ( result, ",", " & " )

     

    But I connt get the point of the meaning of “Amount”.

     

    If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

     

    BTW, pbix as attached.

     

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