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
irnm8dn
Post Prodigy
Post Prodigy

Reference Table through Power BI - PLEASE HELP!

I am trying to build a relationship between two tables.  One of the tables was supposed to have unique values, to create a relationship.

 

Is there a way in PowerBI to take a column from a table, create a third table from the deisred column(the reference table) and distill the values down to a unique set of values?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @irnm8dn

 

You can easily do this in Power Query.

 

Right click Original Table, select Reference , Remove the unwanted columns, select "Remove Duplicates", now you will have the column with unique values .

 

You can use this table as Relationship / Bridge table as you needed.

 

Thanks

Raj

View solution in original post

14 REPLIES 14
v-jiascu-msft
Employee
Employee

Hi @irnm8dn,

 

Could you please mark the proper answers as solutions?

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cb_ohio
Frequent Visitor

I first createsd a table "ORDERS"

ORDERSORDERS

Next, I right click on ORDERS and select "Reference"

Reference TableReference Table 

Next I renamed the table to "INVENTORY" and grouped by "FRUIT"

GROUP.jpg

 

GROUP DIALOG.jpg 

 

Result:

RESULT.jpg

v-jiascu-msft
Employee
Employee

Hi @irnm8dn,

 

A solution using DAX could be like below. Please give it a try.

Table =
FILTER (
    DISTINCT (
        SELECTCOLUMNS ( 'DimProduct', "key", CONCATENATE ( [BrandName], [ColorName] ) )
    ),
    ISBLANK ( [key] ) = FALSE ()
)

Best Regards,

Dale

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

@v-jiascu-msft

 

What is the first step in creating a new table.  It is no longer in the "Modeling" tab?

 

Can you also breakdown the components in the DAX starement so I understand the references and how to translate that to my dataset and how they apply?

 

Thanks!

Hi @irnm8dn,

 

Please refer to the snapshot and the comments on the code.

Table =
FILTER (  //filter out blanks, for you want to establish relationship.
    DISTINCT (  //only keep unique values.
        SELECTCOLUMNS ( 'DimProduct', "key", CONCATENATE ( [BrandName], [ColorName] ) )
    ),  //concatenate two fileds as you mentioned. 'DimProduct' is a table while [BrandName] and [ColorName] are columns of 'DimPorduct'.
    ISBLANK ( [key] ) = FALSE ()
)

Reference_Table_through_Power_BI_PLEASE_HELP

 

 

Best Regards,

Dale

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

On the "Home" tab "Enter Data"

cb_ohio
Frequent Visitor

One quick and easy method would be to make a reference copy of one of the tables and group by the column you want distinct values for.  You can eliminate any of the other columns you don't want.

@cb_ohio

 

Can you send me some screenshots or steps...not sure I know how to do this.

Anonymous
Not applicable

Yes, you can do that way also, Both gives same result.

 

Click on the column you created, Go to Transform Tab -> Click Group by , it will create 2 columns , one is the unique value of your column and another one is based on your selection ( ex: count). You can delete the extra column and keep the custom column.

 

Thanks
Raj

Anonymous
Not applicable

Hi @irnm8dn

 

You can easily do this in Power Query.

 

Right click Original Table, select Reference , Remove the unwanted columns, select "Remove Duplicates", now you will have the column with unique values .

 

You can use this table as Relationship / Bridge table as you needed.

 

Thanks

Raj

@Anonymous

 

Thanks, one last question.  To create the relationships, I am concatenating two colums.  Since this is a function, I can't seem to remove the duplicates in Power Query.  Any thoughts?

 

Thanks!

Anonymous
Not applicable

You will still get that option. Right click on the customn column you have created , you will see Remove duplicates option.

 

Thanks
Raj

Anonymous
Not applicable


@Anonymous wrote:

You will still get that option. Right click on the customn column you have created , you will see Remove duplicates option.

 

Thanks
Raj


 

 

Did you try this?

 

Remove duplicates.PNG

@Anonymous

 

There doesn't seem to be the option to remove duplicates as the column I created using the CONCATENATE function is not showing in Query Editor?

 

 

QE.JPG

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.