Forum Discussion

Kamai's avatar
Kamai
New Member
1 year ago
Solved

More than one ID per cell

Hi there,

I`m quite new to power BI. The internet doesn`t help, so I ended here 😉

I have a file with diffrent releations. Lets call it customers and Products.

We use power BI as some kind of sorting tool. thare are not much changes but it gives us a nice overview.

 

We want to see which customer gets which product.

I have a table with the products, a table with customers and a table for the releation between the two.

 

Product looks like:

 

Product IDProduct_NameProdct_SubnameData1Data2
BiBillirubinControl 1set1set2
TNTroponinControl1set1set2

 

Customer looks like

CustmerIDNameLastnamestreetCityState
1SimonMulerStreet 1LondonUK
2SusanneSaltStreet 2HamburgDE


The relation looks like:

Product_NameCustomer_ID
Bi1; 3; 10
TN2

 

This is an example.

The Product ID isnot be uniq! I have an:m relation here wich qorks fine!

My problem is the relation table with more than one data set in one cell.

I can`t split the coloum in power BI, if I do, I can make only one relation to the customer table.

On the other hand power BI can`t sort the data correctly if more than one set is in the cell.

 

We have just startet our little project and jet we don`t have too many items listed, so we can still change some things.

 

Any help / advise?

 

Many thanks in advanced.

 

BR

Kamai

 

 

 

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Kamai ,

    Based on the testing, transform the relation table data. Select split column by delimiter.

    Unpivot only selected columns.

    Rename the column name.

    Remove Attribute column.

    Select close and apply.

    Then, creating the new measure to filter the product based on customer.

    Measure = 
    var _customer = SELECTEDVALUE('Relation Table'[Customer_ID])
    var _product = SELECTEDVALUE('Product'[Product ID])
    var _result = CALCULATE(MAX('Relation Table'[Product_Name]), FILTER('Relation Table', 'Relation Table'[Customer_ID] = _customer))
    RETURN
    IF(_product = _result, 1, 0)

    Drag the measure to the table visual Filters pane and set show item is 1.

    Select the customer ID. The result is shown below.

    Best Regards,

    Wisdom Wu

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Kamai ,

    Based on the testing, transform the relation table data. Select split column by delimiter.

    Unpivot only selected columns.

    Rename the column name.

    Remove Attribute column.

    Select close and apply.

    Then, creating the new measure to filter the product based on customer.

    Measure = 
    var _customer = SELECTEDVALUE('Relation Table'[Customer_ID])
    var _product = SELECTEDVALUE('Product'[Product ID])
    var _result = CALCULATE(MAX('Relation Table'[Product_Name]), FILTER('Relation Table', 'Relation Table'[Customer_ID] = _customer))
    RETURN
    IF(_product = _result, 1, 0)

    Drag the measure to the table visual Filters pane and set show item is 1.

    Select the customer ID. The result is shown below.

    Best Regards,

    Wisdom Wu

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

  • Kamai's avatar
    Kamai
    New Member

    Hi Wisdom,

    thanks for your quick help!

     

    Could use it  directly!

     

    Thanks!


    BR
    Kamai