Forum Discussion

Abbi's avatar
Abbi
Helper I
4 years ago
Solved

How to create a custom table or Matrix table

Hi All,

Looking forward for your help.

I have 2 tables, Table1 and Table 2.

Table1 -

IDDepedencyOwner
1234ClientMaruti
1234TestingMaruti
1234EnggMaruti
8125SupportVarun M
6542TestingMike
6542SupportMike
6542ReportingMike
6542ClientMike

 

Table2 -

IDDepedency
1234Client
1234Engg
6542Reporting
6542Engg
8125Client
8125Engg
8125Support
9654Client

 

I need to create visual like below: Not sure how can I achieve through a Table or Matrix table.

IDT1.DependencyT2.DependencyOwner
1234ClientClientMaruti
 TestingEngg 
 Engg  
8125SupportClientVarun M
  Engg 
  Support 
6542TestingReportingMike
 SupportEngg 
 Reporting  
 Client  
9654 Client 

 

Please help.

  • Hi Abbi ,

     

    Please check this:

     

    Detail steps:

    1. Create two tables.

    ID = 
    DISTINCT ( UNION ( DISTINCT ( Table1[ID] ), DISTINCT ( Table2[ID] ) ) )
    
    Depedency = 
    DISTINCT (
        UNION ( DISTINCT ( Table1[Depedency] ), DISTINCT ( Table2[Depedency] ) )
    )
    

     

    2. Create relationships.

     

    3. Create a Matrix.

     

     

    For more details, please check the attached .pbix file.

     

     

    Best Regards,

    Icey

     

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

5 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    I recommend approaching this a bit differently. With these steps you can visualize the information you want quite well.
    You can create a dimension table like this one:

    and then use it to create relationships:

     

    By doign this you can create the visual like this:
    Use the dimension table for slicer and then just create two table visuals.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

  • Thanks ValtteriN  for the post, your post doesnt solve my issue, as my clients export the data to csv, they dont want 2 tables. 

     

    If you have any better view other than table please suggest, where i can show them the difference in the dependency  against the ID's 

    • Icey's avatar
      Icey
      Community Support

      Hi Abbi ,

       

      Please check this:

       

      Detail steps:

      1. Create two tables.

      ID = 
      DISTINCT ( UNION ( DISTINCT ( Table1[ID] ), DISTINCT ( Table2[ID] ) ) )
      
      Depedency = 
      DISTINCT (
          UNION ( DISTINCT ( Table1[Depedency] ), DISTINCT ( Table2[Depedency] ) )
      )
      

       

      2. Create relationships.

       

      3. Create a Matrix.

       

       

      For more details, please check the attached .pbix file.

       

       

      Best Regards,

      Icey

       

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

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Abbi ,
    Here is the sample file with solution: https://www.dropbox.com/t/BBz5quuploWDDOAY


    This is very similar to this post https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-Compare-two-columns-from-2-different-tables/m-p/2328322#M58397
    Already ansewed your query but looks like you forgot to mark my answer as accepted 🙂

     

    You can use power query to generate a distinct table of all ID's as described in the other post.
    Code for Table 1 & 2:

    T(n) Dependancy = 
    IF (
        HASONEVALUE ( Append1[ID] ), 
        CONCATENATEX (
            Table(n),
            Table(n)[Depedency],
            "," & UNICHAR(10)
        )
    )

    For "Owner" you just need to retrieve the VALUES of the culumn "Owner" as follows

    Owner = 
    IF (
        HASONEVALUE ( Append1[ID] ), 
        DISTINCT ( VALUES  ( Table1[Owner] ) )
    )

    Your report would look like this

    Kindly requesting you to mark both solutions as "Accepted".
    Thank you and have a great day

    • tamerj1's avatar
      tamerj1
      Community Champion

      Abbi 
      If you're not comfortable with using Power Query, you can create a calculated table using this code:

      Unique ID's = 
      VAR Table_1 =
          SELECTCOLUMNS (
              Table1,
              "ID", Table1[ID]
          )
      VAR Table_2 =
          SELECTCOLUMNS (
              Table2,
              "ID", Table2[ID]
          )
      VAR Result =
          DISTINCT ( UNION ( Table_1, Table_2 ) )
      RETURN
          Result