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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sabilahmed
Resolver I
Resolver I

Calculated column from one table to another table

Hello,

 

I desperately need help with the following problem.

 

I have a calculated column in table "Config" which counts the number of instances per IV_Product_RecID (as there are "many" rows with multiple instances of IV_Product_RecID):

Count_IV_Product_RecID =

    CALCULATE(

        COUNT(Config[IV_Product_RecID]

            ),

            FILTER(

                Config,

                Config[IV_Product_RecID] = EARLIER(Config[IV_Product_RecID])

            )

    )

 

Then I have another table v_rpt_product with only "one" row per IV_Product_RecID. I have made sure there is a one-many relationship beween the two tables as depicted below:

 

sabilahmed_0-1645200212716.png

 

I need to add a calculated column in v_rpt_product telling me the number of times/ instances IV_Product_RecID shows up in the Config table.

 

I tried to "merge" the two tables so I could "expand" to return the calculated column from Config but this did not work as the merge feasture will not return the calculated column. Basically this would have worked in excel like a vlookup.

 

Please help me!

 

Thanks in advance,

S

1 ACCEPTED SOLUTION
sabilahmed
Resolver I
Resolver I

I've done it:

 

Created a calculated column in v_rpt_product:

 

Count_IV_Product_RecID = COUNTROWS(RELATEDTABLE(Config))

View solution in original post

3 REPLIES 3
sabilahmed
Resolver I
Resolver I

I've done it:

 

Created a calculated column in v_rpt_product:

 

Count_IV_Product_RecID = COUNTROWS(RELATEDTABLE(Config))
Anonymous
Not applicable

Have you tried merge queries in power query?

Yes - I mentioned that above, but it didn't work. Due to the nature of the calculation it doesn't appear as one of the columns to expand in the merge.

 

I'm thinking a better way to solve this issue is if I rephrase my questions to this:

How can I create a calculated column in my Config table to return the count of IV_Product_RecID from v_rpt_product table?

 

Remember:

Config has MANY ID's

v_rpt_product has UNIQUE ID's per row

 

Therefore this is a ONE-MANY relationship.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors