Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 6
v-lid-msft
Community Support
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]
    )
)

Find-the-value-based-on-Comma-seperated-list-1.png

 

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, ",", " & " )

Find-the-value-based-on-Comma-seperated-list-2.png

 

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 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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:

2019-08-30 11_00_03-Window.png

Result:

2019-08-30 11_00_27-Window.png

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

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.

Can you give an exemple of what you want to search?

This how you search for a comma. You can use it in a context like LEFT([sales person],FIND(...)-1) kind of thing.

Reference.PNG

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

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:

Reference.PNG

 

Bridge.PNG

 

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.