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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
micklowe
Frequent Visitor

Building a new table from two BI tables

Hi Everyone,

 

I'm trying to build a table based on 2 existing tables but I need to join to one of the tables using a parameter, I have this code which works from one table:

 

ClientCodes=SELECTCOLUMNS(FILTER('anallink','anallink'[AG_Type]="C"),"Type",'anallink'[AG_Type],"AC_Code",'anallink'[AC_Code],"PCT",'anallink'[AL_PCT])

 

I need to bring in another field based on the AL_PCT field, is it possible to do this? 

 

Thanks 

 

Mick

 

1 ACCEPTED SOLUTION
v-xiaosun-msft
Community Support
Community Support

Hi @micklowe ,

 

According to your description, I made a sample and here is my solution.

I wonder whether I understand your requirement correctly, please follow steps below.

Sample data:

vxiaosunmsft_0-1668757297162.png

Create a new table as what you wrote.

ClientCodes =
SELECTCOLUMNS (
    FILTER ( 'TABLE_A', 'TABLE_A'[AG_TYPE] = "C" ),
    "Type", 'TABLE_A'[AG_TYPE],
    "AC_CODE", 'TABLE_A'[AC_CODE],
    "PCT", 'TABLE_A'[AL_PCT]
)

vxiaosunmsft_1-1668757371440.png

Then you can establish a relationship between TABLE_B and new table.

vxiaosunmsft_2-1668757423595.png

Create a calculated column in the new table.

Column =
RELATED ( TABLE_B[OTHER] )

Final output:

vxiaosunmsft_3-1668757485492.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

View solution in original post

1 REPLY 1
v-xiaosun-msft
Community Support
Community Support

Hi @micklowe ,

 

According to your description, I made a sample and here is my solution.

I wonder whether I understand your requirement correctly, please follow steps below.

Sample data:

vxiaosunmsft_0-1668757297162.png

Create a new table as what you wrote.

ClientCodes =
SELECTCOLUMNS (
    FILTER ( 'TABLE_A', 'TABLE_A'[AG_TYPE] = "C" ),
    "Type", 'TABLE_A'[AG_TYPE],
    "AC_CODE", 'TABLE_A'[AC_CODE],
    "PCT", 'TABLE_A'[AL_PCT]
)

vxiaosunmsft_1-1668757371440.png

Then you can establish a relationship between TABLE_B and new table.

vxiaosunmsft_2-1668757423595.png

Create a calculated column in the new table.

Column =
RELATED ( TABLE_B[OTHER] )

Final output:

vxiaosunmsft_3-1668757485492.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.