Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

See all rows in tabel visualisation

Hi all,

 

I am trying to combine 2 tables into 1 from 2 different sources.

When I made the relationship and try to use the table visualisation, not all the IDs is being displayed, is there any way I can show all IDs in the table and rows where no data will show the data as blank?

 

(I simplified it for easier understanding) 

Table 1:   

1

2
3
4
5
3

3

 

Table 2:

2

$100

3$85
5$55
9$75

 

The 2 columns that I am trying to form a relationship with is the 2 IDs and I am expecting this output:

1

 

2

$100

3$85
3$85
3$85
4 
5$55

 

The current relationship they have now is a many to many relationship for ID. The expected data may not make sense but other columns which exist. I just wanted to simplify it.

 

Many thanks in advanced 🙂

  • Anonymous - Well, it really shouldn't matter which one you choose. Keep the bridge table column and try changing those relationships to single direction versus Both.

26 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous - The sample data does not say many-to-many to me but will assume that your larger dataset does. Avoid many-to-many if at all possible. Use a bridge table. You can create one like this:

    Bridge Table =
      DISTINCT(
        UNION(
          SELECTCOLUMNS('Table 1',"ID",[ID]),
          SELECTCOLUMNS('Table 2',"ID",[ID]),
        )
      )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Greg_Deckler 

       

      I tried doing this and the data still only allows me to select many to many relationship which is odd.

      Is there a reason for this?

       

      Thank you for your help

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Anonymous - It's really, really hard to say without seeing how everything is configured and laid out. Any screen shots you could post of what you are seeing and how the visuals are configured would be extremely helpful. Can you share the PBIX? Can you share a mock-up PBIX of your data where we can witness what you are seeing? These things are notoriously difficult to troubleshoot. I don't even know what exactly your calculation is.

        The screen shot as well as the attached PBIX file (below sig) Page 35, Table (35) and Table (35a) show that it is indeed possible to achieve:

         

  • Anonymous ,

    One is the max measure on table2 when table 2 is joined with Table 1

    Max(Table[value])

     

    Another option is a new column in table 1

     

    MaxX(filter(Table2, Table2[Id] =Table1[Id]), Table2[Value])

     

     

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous - You might have an option, if you click on the drop down in the Visualizations pane of a column to "Show items with no data". That might help. Otherwise, you might do this:

    Measure =
      VAR __Calc = <some calculation>
    RETURN
      IF(ISBLANK(__Calc) || __Calc="",0,__Calc)
  • FarhanAhmed's avatar
    FarhanAhmed
    Community Champion

    Any visualization group your duplicate data (any number of column selected) in to 1 and perform aggregation based on values. 

    In your case 3 will not repeat 3 times and you will see 3 one time and value as aggregation (either SUM, AVG or No summarization)

     

    For unmatched data you can right click field and select "show items with no data" to get missing values

     

    If you want to view all of your data from table 1, you need to create index column and bring that index column in visualization so that group can become separate and hence all rows will be return from table 1

     

    you can refer this article 

    https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Greg_Deckler 

     

    My data in ID looks like this.

    A12_2KSPF3_A01
    SEB/CA/2/38
    A12_2KSNPF7_A01
    ACB/C10A12-01-09-09/1

     

    Thank you so much for trying to help me with this 

    • Greg_Deckler's avatar
      Greg_Deckler
      Community Champion

      Anonymous - OK, here is my theory. Buried in your list of ID's are "duplicates", something like the following:

      A12_2KSPF3_A01

      a12_2KSPF3_A01

       

      That's what I am thinking. Something that DISTINCT isn't catching but the relationships see as duplicates. I know this has come up before. Let me see if I can research it.

       

      Another possibility, trailing special characters or spaces. Make sure that in your Power Query that you use both Trim and Clean operations on your columns that eventually become the ID column.

       

      Another option, create your bridge table in Power Query. Reference your original queries and create 2 new queries that only have that column in them. Use an Append query to union them. Then do a Remove duplicates operation.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

         Hi Greg_Deckler 

         

        So it is this that is causing my data to be repeated again and again, right?

        As my data is currently repeating every single row for every single value of RunAmp. So if I manage to solve this, my data should be fine?

         

        Thank you for your help.