cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Query Between Two Tables & Add Additional Lines

 

Hastings2023_1-1676310771110.pngHastings2023_2-1676310812308.png

I have two excel spreadsheets that I have loaded up into Power Bi.  One is a ref table that lists all the zip codes within a circuit and the multiplier that needs to be applied to column "E" and "F" in the second spreadsheet.

The table on the right does not contain Zip Code.  Can Power Bi input lines base on circuit to add zip code?  Then if I can do that, I need the multiplier times the "CI" & "CMI" based on the circuit and the zip code in the table on the left.

We tried the lookupvalue but we were unsuccessful due to multiple circuit numbers and think calculate could work but unsure of the input functionality.

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

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. In Power Query -- Create Indices for the two tables -- Add Column – Index Column – From 1.

vyangliumsft_0-1676527811496.png

2. Create calculated column.

Zip Code =
MAXX(
    FILTER(ALL(Table1),
    'Table1'[Index]=EARLIER('Table2'[Index])),[Zip Code])

vyangliumsft_1-1676527811496.png

Column =
VAR _CI=
SUMX(
    FILTER(ALL('Table2'),
    'Table2'[Zip Code]=EARLIER('Table1'[Zip Code])),[CI])
VAR _CMI=
SUMX(
    FILTER(ALL('Table2'),
    'Table2'[Zip Code]=EARLIER('Table1'[Zip Code])),[CMI])
RETURN
_CI * _CMI

2. Result:

vyangliumsft_2-1676527811497.png

 

Whether it meets your expected results, if not, you can express their expected results in the form of pictures, and we can help you better.

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. In Power Query -- Create Indices for the two tables -- Add Column – Index Column – From 1.

vyangliumsft_0-1676527811496.png

2. Create calculated column.

Zip Code =
MAXX(
    FILTER(ALL(Table1),
    'Table1'[Index]=EARLIER('Table2'[Index])),[Zip Code])

vyangliumsft_1-1676527811496.png

Column =
VAR _CI=
SUMX(
    FILTER(ALL('Table2'),
    'Table2'[Zip Code]=EARLIER('Table1'[Zip Code])),[CI])
VAR _CMI=
SUMX(
    FILTER(ALL('Table2'),
    'Table2'[Zip Code]=EARLIER('Table1'[Zip Code])),[CMI])
RETURN
_CI * _CMI

2. Result:

vyangliumsft_2-1676527811497.png

 

Whether it meets your expected results, if not, you can express their expected results in the form of pictures, and we can help you better.

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors